Home > Mobile >  How to get the System Assigned Identity of Azure Synapse Workspace using Terraform?
How to get the System Assigned Identity of Azure Synapse Workspace using Terraform?

Time:10-09

I am trying to get the System Assigned Managed identity for Azure Synapse

I have the following Terraform Code

// Create Synapse Workspace
resource "azurerm_synapse_workspace" "synapsews" {
  name                                 = var.dat_synapse_ws
  resource_group_name                  = azurerm_resource_group.resource_group.name
  location                             = azurerm_resource_group.resource_group.location
  storage_data_lake_gen2_filesystem_id = azurerm_storage_data_lake_gen2_filesystem.datalake-config.id
  sql_identity_control_enabled         = true
  sql_administrator_login              = var.synapse_sql_administrator_login
  sql_administrator_login_password     = var.synapse_sql_administrator_login_password
  managed_virtual_network_enabled      = true

  aad_admin {
    login = data.azuread_user.user.mail
    object_id = data.azuread_user.user.object_id
    tenant_id = data.azurerm_client_config.current.tenant_id
  }
  
  identity {
    type         = "SystemAssigned"
  }

  depends_on = [ azurerm_storage_account.datalake ]
}

How to get the System Assigned Identity of Azure Synapse Workspace using Terraform?

Note: Please leave a comment before voting down.. so that I will know why exactly this is marked down..!

CodePudding user response:

After applying your terraform code, you can reference the Managed Service Identity of this Synapse Workspace like this azurerm_synapse_workspace.synapsews.principal_id

More info: identity Source: https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/synapse_workspace#principal_id

  • Related