如何通过 ARM 模板中的 ObjectID 获取 Azure AD 安全组名称?

How can I get an Azure AD security group name by ObjectID in ARM template?

我正在尝试使用以下方法从其对象 ID 获取 AAD 组名:

reference(parameters('groupId')).displayName

但是我得到错误:

The template reference <groupId> is not valid.

我做错了什么?

您只能使用 reference() 函数引用 Azure 资源,不能引用 Azure AD 实体。这不可能。您必须在模板之外执行此操作并将显示名称传递给模板。