简体   繁体   English

将 Azure AD Microsoft Graph API 权限添加到 B2C 应用程序

[英]Adding Azure AD Microsoft Graph API Permissions to B2C Application

I am using the following Az Cli command to create an Azure AD B2C application:我正在使用以下 Az Cli 命令来创建 Azure AD B2C 应用程序:

az ad app create --display-name 'mytestapplication'

What I'd then also like to do in the process is grant some permissions, as per the Azure AD Microsoft Graph API permissions list.在此过程中,我还想做的是根据 Azure AD Microsoft Graph API 权限列表授予一些权限。 Below are two such examples of the permissions I'd like to grant.下面是我想授予的权限的两个此类示例。 I'm however struggling to find any Az Cli examples or references that can enable me achieve this.然而,我正在努力寻找可以让我实现这一目标的任何 Az Cli 示例或参考资料。 Any suggestions?有什么建议?

User.ReadWrite.All
Application.ReadWrite.All

In order to grant a specific permission for an app registration , you need to pass those permissions in manifest.json file with a particular scope.为了授予应用程序注册的特定权限,您需要在具有特定范围的manifest.json文件中传递这些权限。

You can use the below cmdlet to create a app registration & to assign the specific azure-ad-microsoft-graph-api-permissions for that app registration.您可以使用以下 cmdlet 创建应用注册并为该应用注册分配特定的 azure-ad-microsoft-graph-api-permissions。

az login -tenant  [myb2ctenant.onmicrosoft.com](http://myb2ctenant.onmicrosoft.com/)  --allow-no-subscriptions (this cmd helped me to login to B2C without subscription)

az ad app create --display-name 'mytestapplication' --required-resource-accesses @manifest.json

manifest.json file: manifest.json 文件:

{
"requiredResourceAccess": [
        {
            "resourceAppId": "00000003-0000-0000-c000-000000000000",
            "resourceAccess": [
                {
                    "id": "204e0828-b5ca-4ad8-b9f3-f32a958e7cc4"(# for Application.ReadWrite.All),
                    "type": "Scope"
                },
                {
                    "id": "1bfefb4e-e0b5-418b-a88f-73c46d2cc8e9(# for User.ReadWrite.All)",
                    "type": "Role"
                }
            ]
        }
    ]
}

Here is the output screenshot for reference:这是输出屏幕截图以供参考:

在此处输入图片说明

For more information about app registration creation & Assigning permissions for a native app registration cmdlets you can refer this documentation.有关创建应用程序注册和为本机应用程序注册 cmdlet 分配权限的更多信息,您可以参考文档。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM