Search code examples
azureazure-resource-managerazure-managed-identityazure-bicep

Output parameters for user-assigned-identity in bicep?


I'm trying to retrieve the Client ID of a Managed Identity created with Azure Bicep. But the documentation doesn't give any information about the output parameters. Am I missing something? How can I retrieve the client id after defining the Managed Identity in bicep ?


Solution

  • The clientId is available on the properties of the identity:

    param identityName string
    
    resource identity 'Microsoft.ManagedIdentity/userAssignedIdentities@2022-01-31-preview' = {
      name: identityName
      location: resourceGroup().location
    }
    
    output clientId string = identity.properties.clientId