AstroBoy
AstroBoy

Reputation: 367

Get Azure active directory user group objectId in ARM template

Hi I am trying to deploy the resource using ARM template of type "Microsoft.Sql/servers/administrators" below is the template

{
          "type": "Microsoft.Sql/servers/administrators",
          "apiVersion": "2019-06-01-preview",
          "name": "[concat(parameters('sqlServerName'), '/ActiveDirectory')]",
          "dependsOn": [
            "[resourceId('Microsoft.Sql/servers', parameters('sqlServerName'))]"
          ],
          "properties": {
            "administratorType": "ActiveDirectory",
            "login": "[parameters('activeDirectoryUserGroupName')]",
            "sid": "",
            "tenantId": "[subscription().tenantId]"
          }
        }

I am passing the active directory user group name as parameter, "sid" is the objectId of that active directory group. So is there any way to fetch the objectId in ARM template

Upvotes: 1

Views: 4990

Answers (1)

Jim Xu
Jim Xu

Reputation: 23111

We have no way to get the Azure AD group object id in Azure ARM template. Because the Azure AD group is Azure AD resource. It is not Azure resource. But the ARM template is only used to manage Azure resources. For more details, please refer to the document and the document

If the want to get the AD group object id, you can use Azure Powershell command $groubId=(Get-AzADGroup -DisplayName <groupName>).Id.

Upvotes: 3

Related Questions