使用 .net SDK 向 Azure 应用程序添加权限
Add permissions to an Azure application by using the .net SDK
我正在尝试在 Azure 上自动创建应用程序,我一直在搜索 .Net SDK,但找不到如何向 new\existing 应用程序添加权限.
我能够找到与我正在尝试执行的操作等效的 cli 命令:
az ad app permission add --id {APPLICATION_ID} --api 00000002-0000-0000-c000-000000000000 --api-permissions c5366453-9fb0-48a5-a156-24f0c49a4b84=Scope
(c5366453-9fb0-48a5-a156-24f0c49a4b84 是 Directory.ReadWrite.All)
根据记录,我正在使用以下 C# 命令创建应用程序:
var appRegistrationRes = await graphService.Applications.Define($"My App")
.WithSignOnUrl("https://my-site-url.com/")
.DefinePasswordCredential("password")
.WithPasswordValue(password)
.WithDuration(TimeSpan.FromDays(365 * 10))
.Attach()
.WithAvailableToOtherTenants(false)
.CreateAsync();
我正在尝试在 Azure 上自动创建应用程序,我一直在搜索 .Net SDK,但找不到如何向 new\existing 应用程序添加权限.
我能够找到与我正在尝试执行的操作等效的 cli 命令:
az ad app permission add --id {APPLICATION_ID} --api 00000002-0000-0000-c000-000000000000 --api-permissions c5366453-9fb0-48a5-a156-24f0c49a4b84=Scope
(c5366453-9fb0-48a5-a156-24f0c49a4b84 是 Directory.ReadWrite.All)
根据记录,我正在使用以下 C# 命令创建应用程序:
var appRegistrationRes = await graphService.Applications.Define($"My App")
.WithSignOnUrl("https://my-site-url.com/")
.DefinePasswordCredential("password")
.WithPasswordValue(password)
.WithDuration(TimeSpan.FromDays(365 * 10))
.Attach()
.WithAvailableToOtherTenants(false)
.CreateAsync();