我正在尝试使用可以访问Windows Azure AD的更新清单创建Azure AD应用程序。我已经能够成功创建/配置新的应用程序注册,但在尝试配置Manifest时会遇到问题。
我已经尝试使用示例代码提供我的MS(https://docs.microsoft.com/en-us/cli/azure/ad/app?view=azure-cli-latest#az-ad-app-create)和已经存在的App Registration更新的'resourceAppId'但是bash会抛出错误
az ad app create --display-name myTest --homepage https://blah.test.com --reply-urls https://blah.test.com/.auth/login/add/callback --required-resource-accesses @manifest.json("manifest.json" contains the following content)
[{"resourceAppId": "00000002-0000-0000-c000-000000000000",
"resourceAccess": [
{
"id": "a42657d6-7f20-40e3-b6f0-cee03008a62a-test",
"type": "Scope"
}
]
}]
因为我已经复制了示例代码并且只更新了几个参数,我希望它能够运行。任何建议的TIA
这是我通过门户网站运行时收到的错误
因为您提供的信息太少,我不确定您的错误是什么。
我已经测试了你的脚本,我在下面收到了一个错误。
az ad app create --display-name 'myTest' --homepage 'https://blah.test.com --reply-urls https://blah.test.com/.auth/login/add/callback' --required-resource-accesses 'C:\Users\joyw\Desktop\manifest.json'
az : ERROR: '--identifier-uris' is required for creating an application
At line:1 char:1
+ az ad app create --display-name 'myTest' --homepage 'https://blah.tes ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (ERROR: '--ident... an application:String) [], RemoteException
+ FullyQualifiedErrorId : NativeCommandError
如果你也得到这个错误,只需添加像--identifier-uris 'https://mytestapp.websites.net'
这样的参数,完整的命令就像:
az ad app create --display-name 'myTest' --homepage 'https://blah.test.com' --reply-urls 'https://blah.test.com/.auth/login/add/callback' --identifier-uris 'https://mytestapp.websites.net' --required-resource-accesses 'C:\Users\joyw\Desktop\manifest.json'
然后它会正常工作。
根据我的理解,你可能会认为你的resourceAppId
中的manifest.json
有些不对劲。如果您没有收到上述错误,可以按照以下信息进行故障排除,并确保在manifest.json
中使用正确的属性。
我的manifest.json
文件:
[{
"resourceAppId": "69ae001f-xxxxxxxx-375585ac983e",
"resourceAccess": [
{
"id": "6833b2c6-9954-43e1-ac46-f54a26a3b693",
"type": "Scope"
},
{
"id": "1b4f816e-5eaf-48b9-8613-7923830595ad",
"type": "Role"
}
]
}]
resourceAppId
是服务主体的应用程序ID(即AD App的应用程序ID),因此您是正确的。
在resourceAccess
,type
是Scope
或Role
。 Scope
代表委托许可,Role
代表申请许可。对于应用程序权限,您可以在正在使用的AD应用程序清单中的appRoles
中找到它(对于我的示例是应用程序69ae001f-xxxxxxxx-375585ac983e
)。对于Delegated权限,您可以在清单中的oauth2Permissions
中找到它。然后将id
放在相应的位置。
检查它与我的样本AD App的清单,注意id
和通信,它将是清楚的。
appRoles:
"appRoles": [
{
"allowedMemberTypes": [
"Application"
],
"displayName": "SurveyCreator",
"id": "1b4f816e-5eaf-48b9-8613-7923830595ad",
"isEnabled": true,
"description": "Creators can create Surveys",
"value": "SurveyCreator"
}
]
oauth2Permissions:
"oauth2Permissions": [
{
"adminConsentDescription": "Allow the application to access joywebtest on behalf of the signed-in user.",
"adminConsentDisplayName": "Access joywebtest",
"id": "6833b2c6-9954-43e1-ac46-f54a26a3b693",
"isEnabled": true,
"type": "User",
"userConsentDescription": "Allow the application to access joywebtest on your behalf.",
"userConsentDisplayName": "Access joywebtest",
"value": "user_impersonation"
}
]
最后,我们可以检查刚才在门户网站中创建的AD App。它将具有我们设置的必需权限。
有关更多详细信息,您还可以查看Azure Active Directory app manifest。