ARM Template: Looking up a user object Id

前端 未结 3 1198
小鲜肉
小鲜肉 2021-01-19 11:04

I\'m trying to programatically insert the object Id of a certain user account into an ARM template, like this:

\"objectId\": \"[reference(resourceId(\'Micros         


        
3条回答
  •  温柔的废话
    2021-01-19 11:21

    You can try from below code if you have VM in same template and enabled managed identity

    https://docs.microsoft.com/en-us/azure/azure-resource-manager/resource-group-template-functions-resource#remarks-1

    {
      "type": "Microsoft.KeyVault/vaults",
      "properties": {
        "tenantId": "[reference(concat('Microsoft.Compute/virtualMachines/', variables('vmName')), '2017-03-30', 'Full').identity.tenantId]",
        "accessPolicies": [
          {
            "tenantId": "[reference(concat('Microsoft.Compute/virtualMachines/', variables('vmName')), '2017-03-30', 'Full').identity.tenantId]",
            "objectId": "[reference(concat('Microsoft.Compute/virtualMachines/', variables('vmName')), '2017-03-30', 'Full').identity.principalId]",
            "permissions": {
              "keys": [
                "all"
              ],
              "secrets": [
                "all"
              ]
            }
          }
        ]
    

提交回复
热议问题