From c2bd9a8d1b09b659f5a1e5be7fa6dd52186a7fb8 Mon Sep 17 00:00:00 2001 From: neil-yechenwei Date: Wed, 12 Feb 2025 16:36:25 +0800 Subject: [PATCH] Add example for Microsoft.Synapse_workspaces_azureADOnlyAuthentications@2021-06-01-preview --- .../main.tf | 107 ++++++++++++++++++ 1 file changed, 107 insertions(+) create mode 100644 examples/Microsoft.Synapse_workspaces_azureADOnlyAuthentications@2021-06-01-preview/main.tf diff --git a/examples/Microsoft.Synapse_workspaces_azureADOnlyAuthentications@2021-06-01-preview/main.tf b/examples/Microsoft.Synapse_workspaces_azureADOnlyAuthentications@2021-06-01-preview/main.tf new file mode 100644 index 000000000..1852e47b4 --- /dev/null +++ b/examples/Microsoft.Synapse_workspaces_azureADOnlyAuthentications@2021-06-01-preview/main.tf @@ -0,0 +1,107 @@ +terraform { + required_providers { + azapi = { + source = "Azure/azapi" + } + } +} + +provider "azapi" { + skip_provider_registration = false +} + +variable "resource_name" { + type = string + default = "acctest0001" +} + +variable "location" { + type = string + default = "eastus" +} + +resource "azapi_resource" "resourceGroup" { + type = "Microsoft.Resources/resourceGroups@2020-06-01" + name = var.resource_name + location = var.location +} + +resource "azapi_resource" "storageAccount" { + type = "Microsoft.Storage/storageAccounts@2021-09-01" + parent_id = azapi_resource.resourceGroup.id + name = var.resource_name + location = var.location + body = { + kind = "StorageV2" + properties = { + } + sku = { + name = "Standard_LRS" + } + } + schema_validation_enabled = false + response_export_values = ["*"] +} + +data "azapi_resource_action" "listKeys" { + type = "Microsoft.Storage/storageAccounts@2022-09-01" + resource_id = azapi_resource.storageAccount.id + action = "listKeys" + response_export_values = ["*"] +} + +data "azapi_resource" "blobService" { + type = "Microsoft.Storage/storageAccounts/blobServices@2022-09-01" + parent_id = azapi_resource.storageAccount.id + name = "default" +} + +resource "azapi_resource" "container" { + type = "Microsoft.Storage/storageAccounts/blobServices/containers@2022-09-01" + name = var.resource_name + parent_id = data.azapi_resource.blobService.id + body = { + properties = { + metadata = { + key = "value" + } + } + } + response_export_values = ["*"] +} + +resource "azapi_resource" "workspace" { + type = "Microsoft.Synapse/workspaces@2021-06-01" + parent_id = azapi_resource.resourceGroup.id + name = var.resource_name + location = var.location + identity { + type = "SystemAssigned" + identity_ids = [] + } + body = { + properties = { + defaultDataLakeStorage = { + accountUrl = azapi_resource.storageAccount.output.properties.primaryEndpoints.dfs + filesystem = azapi_resource.container.name + } + managedVirtualNetwork = "" + publicNetworkAccess = "Enabled" + sqlAdministratorLogin = "sqladminuser" + sqlAdministratorLoginPassword = "H@Sh1CoR3!" + } + } + schema_validation_enabled = false + response_export_values = ["*"] +} + +resource "azapi_update_resource" "synapse_azuread_only_authentication" { + type = "Microsoft.Synapse/workspaces/azureADOnlyAuthentications@2021-06-01-preview" + resource_id = "${azapi_resource.workspace.id}/azureADOnlyAuthentications/default" + + body = { + properties = { + azureADOnlyAuthentication = true + } + } +}