使用MVC或C#.NET应用程序编辑Azure AD应用程序的requiredResourceAccess

编程入门 行业动态 更新时间:2024-10-11 13:25:22
本文介绍了使用MVC或C#.NET应用程序编辑Azure AD应用程序的requiredResourceAccess的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我正在运行 C#应用程序中的 PowerShell 代码,以在Azure AD中注册一个应用程序(在Azure AD中创建一个应用程序).我想为" Power BI Service "和" Windows Azure Active Directory ".

I am running PowerShell code from C# app to register an application in Azure AD (create an application in Azure AD).I want to Add and Grant permissions for "Power BI Service" and "Windows Azure Active Directory" on this registered application.

我发现我们还可以编辑Azure AD应用程序的Manifest并传递requiredResourceAccess数组.这将自动添加并授予该应用程序的权限.

I found that we can also edit the Manifest of Azure AD application and pass requiredResourceAccess array. This will automatically add and grant permission for the application.

请帮助我使用PowerShell命令,这些命令可以使用C#代码或C#代码运行,以编辑应用程序的Manifest ,以便以编程方式向Azure广告应用程序添加授予和权限.

Please help me with PowerShell commands which can be run using C# code or C# code to edit Manifest of application so that add grant and permissions to Azure Ad Application programatically.

推荐答案

请尝试下面的powershell命令,在示例中,它授予Windows Azure Active Directory api和Power BI Service api的某些权限.

Try the powershell command below, in the sample, it grants the some permissions of Windows Azure Active Directory api and Power BI Service api.

$req = New-Object -TypeName "Microsoft.Open.AzureAD.Model.RequiredResourceAccess" $acc1 = New-Object -TypeName "Microsoft.Open.AzureAD.Model.ResourceAccess" -ArgumentList "311a71cc-e848-46a1-bdf8-97ff7156d8e6","Scope" $acc2 = New-Object -TypeName "Microsoft.Open.AzureAD.Model.ResourceAccess" -ArgumentList "aaff0dfd-0295-48b6-a5cc-9f465bc87928","Role" $req.ResourceAccess = $acc1,$acc2 $req.ResourceAppId = "00000002-0000-0000-c000-000000000000" $reqe = New-Object -TypeName "Microsoft.Open.AzureAD.Model.RequiredResourceAccess" $acc1e = New-Object -TypeName "Microsoft.Open.AzureAD.Model.ResourceAccess" -ArgumentList "ddb3ca45-a192-477d-acb2-46bf9dc586de","Scope" $acc2e = New-Object -TypeName "Microsoft.Open.AzureAD.Model.ResourceAccess" -ArgumentList "28379fa9-8596-4fd9-869e-cb60a93b5d84","Role" $reqe.ResourceAccess = $acc1e,$acc2e $reqe.ResourceAppId = "00000009-0000-0000-c000-000000000000" Set-AzureADApplication -ObjectId <ObjectId> -RequiredResourceAccess @($req,$reqe)

更多推荐

使用MVC或C#.NET应用程序编辑Azure AD应用程序的requiredResourceAccess

本文发布于:2023-11-28 11:36:18,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1642238.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:应用程序   编辑   NET   MVC   AD

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!