tot*_*0ud 4 azure azure-active-directory azure-cli azure-devops
我正在尝试使用可以访问 Windows Azure AD 的更新清单创建 Azure AD 应用程序。我已经能够成功创建/配置新的应用程序注册,但在尝试配置清单时遇到问题。
我尝试使用我的MS(https://learn.microsoft.com/en-us/cli/azure/ad/app?view=azure-cli-latest#az-ad-app-create)提供的示例代码来自现有应用程序注册的更新的“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"
}
]
}]
Run Code Online (Sandbox Code Playgroud)
由于我已经复制了示例代码并刚刚更新了一些参数,因此我希望它能够运行。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
Run Code Online (Sandbox Code Playgroud)
如果您也遇到此错误,只需添加类似参数--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'
Run Code Online (Sandbox Code Playgroud)
然后它就会工作得很好。
据我了解,您可能认为您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"
}
]
}]
Run Code Online (Sandbox Code Playgroud)
这resourceAppId是服务主体的应用程序ID(即AD应用程序的应用程序ID),所以你是对的。
在 中resourceAccess,type是Scope或Role。代表Delegate权限,Scope代表Application权限。对于应用程序权限,您可以在您正在使用的 AD 应用程序的清单中找到它(对于我的示例是应用程序)。对于委托权限,您可以在清单中找到它。然后拿到对应的位置。RoleappRoles69ae001f-xxxxxxxx-375585ac983eoauth2Permissionsid
将其与我的示例 AD 应用程序清单一起检查,记下id和对应关系,就会清楚了。
应用角色:
"appRoles": [
{
"allowedMemberTypes": [
"Application"
],
"displayName": "SurveyCreator",
"id": "1b4f816e-5eaf-48b9-8613-7923830595ad",
"isEnabled": true,
"description": "Creators can create Surveys",
"value": "SurveyCreator"
}
]
Run Code Online (Sandbox Code Playgroud)
oauth2权限:
"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"
}
]
Run Code Online (Sandbox Code Playgroud)
最后,我们可以在门户中查看刚才创建的AD App。它将具有我们设置的必需权限。
有关更多详细信息,您还可以查看Azure Active Directory 应用程序清单。
| 归档时间: |
|
| 查看次数: |
3295 次 |
| 最近记录: |