Skip to content

azurermSynapseWorkspaceAadAdmin

Manages an Azure Active Directory SQL Administrator setting for a Synapse Workspace

Example Usage

/*Provider bindings are generated by running cdktf get.
See https://cdk.tf/provider-generation for more details.*/
import * as azurerm from "./.gen/providers/azurerm";
/*The following providers are missing schema information and might need manual adjustments to synthesize correctly: azurerm.
For a more precise conversion please use the --provider flag in convert.*/
const azurermResourceGroupExample = new azurerm.resourceGroup.ResourceGroup(
  this,
  "example",
  {
    location: "West Europe",
    name: "example-resources",
  }
);
const azurermStorageAccountExample = new azurerm.storageAccount.StorageAccount(
  this,
  "example_1",
  {
    account_kind: "StorageV2",
    account_replication_type: "LRS",
    account_tier: "Standard",
    is_hns_enabled: "true",
    location: azurermResourceGroupExample.location,
    name: "examplestorageacc",
    resource_group_name: azurermResourceGroupExample.name,
  }
);
/*This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match.*/
azurermStorageAccountExample.overrideLogicalId("example");
const azurermStorageDataLakeGen2FilesystemExample =
  new azurerm.storageDataLakeGen2Filesystem.StorageDataLakeGen2Filesystem(
    this,
    "example_2",
    {
      name: "example",
      storage_account_id: azurermStorageAccountExample.id,
    }
  );
/*This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match.*/
azurermStorageDataLakeGen2FilesystemExample.overrideLogicalId("example");
const azurermSynapseWorkspaceExample =
  new azurerm.synapseWorkspace.SynapseWorkspace(this, "example_3", {
    identity: [
      {
        type: "SystemAssigned",
      },
    ],
    location: azurermResourceGroupExample.location,
    name: "example",
    resource_group_name: azurermResourceGroupExample.name,
    sql_administrator_login: "sqladminuser",
    sql_administrator_login_password: "H@Sh1CoR3!",
    storage_data_lake_gen2_filesystem_id:
      azurermStorageDataLakeGen2FilesystemExample.id,
    tags: {
      Env: "production",
    },
  });
/*This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match.*/
azurermSynapseWorkspaceExample.overrideLogicalId("example");
const dataAzurermClientConfigCurrent =
  new azurerm.dataAzurermClientConfig.DataAzurermClientConfig(
    this,
    "current",
    {}
  );
const azurermKeyVaultExample = new azurerm.keyVault.KeyVault(
  this,
  "example_5",
  {
    location: azurermResourceGroupExample.location,
    name: "example",
    purge_protection_enabled: true,
    resource_group_name: azurermResourceGroupExample.name,
    sku_name: "standard",
    tenant_id: dataAzurermClientConfigCurrent.tenantId,
  }
);
/*This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match.*/
azurermKeyVaultExample.overrideLogicalId("example");
const azurermKeyVaultAccessPolicyDeployer =
  new azurerm.keyVaultAccessPolicy.KeyVaultAccessPolicy(this, "deployer", {
    key_permissions: ["Create", "Get", "Delete", "Purge", "GetRotationPolicy"],
    key_vault_id: azurermKeyVaultExample.id,
    object_id: dataAzurermClientConfigCurrent.objectId,
    tenant_id: dataAzurermClientConfigCurrent.tenantId,
  });
const azurermKeyVaultKeyExample = new azurerm.keyVaultKey.KeyVaultKey(
  this,
  "example_7",
  {
    depends_on: [`\${${azurermKeyVaultAccessPolicyDeployer.fqn}}`],
    key_opts: ["unwrapKey", "wrapKey"],
    key_size: 2048,
    key_type: "RSA",
    key_vault_id: azurermKeyVaultExample.id,
    name: "workspace-encryption-key",
  }
);
/*This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match.*/
azurermKeyVaultKeyExample.overrideLogicalId("example");
const azurermSynapseWorkspaceSqlAadAdminExample =
  new azurerm.synapseWorkspaceSqlAadAdmin.SynapseWorkspaceSqlAadAdmin(
    this,
    "example_8",
    {
      login: "AzureAD Admin",
      object_id: dataAzurermClientConfigCurrent.objectId,
      synapse_workspace_id: azurermSynapseWorkspaceExample.id,
      tenant_id: dataAzurermClientConfigCurrent.tenantId,
    }
  );
/*This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match.*/
azurermSynapseWorkspaceSqlAadAdminExample.overrideLogicalId("example");

Arguments Reference

The following arguments are supported:

  • synapseWorkspaceId - (Required) The ID of the Synapse Workspace where the Azure AD Administrator should be configured.

  • login - (Required) The login name of the Azure AD Administrator of this Synapse Workspace.

  • objectId - (Required) The object id of the Azure AD Administrator of this Synapse Workspace.

  • tenantId - (Required) The tenant id of the Azure AD Administrator of this Synapse Workspace.

Timeouts

The timeouts block allows you to specify timeouts for certain actions:

  • create - (Defaults to 30 minutes) Used when creating the Synapse Workspace.
  • read - (Defaults to 5 minutes) Used when retrieving the Synapse Workspace.
  • update - (Defaults to 30 minutes) Used when updating the Synapse Workspace.
  • delete - (Defaults to 30 minutes) Used when deleting the Synapse Workspace.

Import

Synapse Workspace Azure AD Administrator can be imported using the resourceId, e.g.

terraform import azurerm_synapse_workspace_sql_aad_admin.example /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/resourceGroup1/providers/Microsoft.Synapse/workspaces/workspace1/sqlAdministrators/activeDirectory