我想为Azure SQL数据库设置AzureAD管理员。为此,我需要同时设置登录名(电子邮件)和principalId
。
不是将电子邮件和principalId
都作为ARM模板输入参数传递,我只希望传递用户电子邮件。然后在模板中,我想通过电子邮件获取用户principalId
。对于托管身份,可以这样做:
[reference(resourceId('Microsoft.Web/sites', variables('web-app-name')), '2019-08-01', 'full').identity.principalId]
但是我无法为用户找到类似的方法。
您可能需要使用脚本来获取ID,然后将其作为参数传递给ARM模板。
例如,您可以使用AzureAD PowerShell模块:https://docs.microsoft.com/en-us/powershell/module/azuread/?view=azureadps-2.0
Get-AzureADUser -Filter "userPrincipalName eq '[email protected]'"
它不漂亮,仍在预览中,但是ARM templates now have support for executing scripts。