gpt4 book ai didi

azure - 如何将范围和 ApplicationURI 添加到 Azure AD 应用程序注册?

转载 作者:行者123 更新时间:2023-12-03 03:40:32 34 4
gpt4 key购买 nike

我有一个 powershell 脚本,用于创建 azure ad app reg。我已经能够创建它,添加 ms graph 权限并创建一个 secret 。这是我到目前为止所拥有的:

$newapp = New-AzADApplication -DisplayName "mynewApp" -AvailableToOtherTenants $false
Write-Output $newapp
# add a certificate / client secret
$appCredentials = New-AzADAppCredential -ApplicationId $newapp.AppId -StartDate $startDate -EndDate $endDate

$identifierUris = @()
$identifierUris += "api://$newapp.AppId"
$webAppUrl = "https://$functionAppName.azurewebsites.net"
# when you add a redirect URI Azure creates a "web" policy.
$redirectUris = @()
$redirectUris += "$webAppUrl"

Update-AzADApplication -ApplicationId $newapp.AppId -ReplyUrl $redirectUris | Out-Null
#Adds MS Graph User.Read permission
Add-AzADAppPermission -ApplicationId $newapp.AppId -ApiId "00000003-0000-0000-c000-000000000000" -PermissionId "e1fe6dd8-ba31-4d61-89e7-88639da4683d"

但现在我需要知道如何创建应用程序 Uri(如下所示),以及如何创建范围。

enter image description here

最佳答案

您可以使用带有以下参数的New-AzureADApplication命令

  • 要添加标识符 URI - 使用 -IdentifierUris 参数。
  • 要添加范围 - 使用 -Oauth2Permissions 参数。
New-AzureADApplication
[-AvailableToOtherTenants <Boolean>]
-DisplayName <String>
[-IdentifierUris <System.Collections.Generic.List`1[System.String]>]
[-Oauth2Permissions <System.Collections.Generic.List`1[Microsoft.Open.AzureAD.Model.OAuth2Permission]>]
[-ReplyUrls <System.Collections.Generic.List`1[System.String]>]
[-RequiredResourceAccess <System.Collections.Generic.List`1[Microsoft.Open.AzureAD.Model.RequiredResourceAccess]>]

例如,您可以创建 OAuth2Permission 对象,例如 -

$scope = New-Object Microsoft.Open.AzureAD.Model.OAuth2Permission
$scope.Id = New-Guid
$scope.Value = "user_impersonation"
$scope.UserConsentDisplayName = "<value>"
$scope.UserConsentDescription = "<value>"
$scope.AdminConsentDisplayName = "<value>"
$scope.AdminConsentDescription = "<value>"
$scope.IsEnabled = $true
$scope.Type = "User"

请引用this有关详细信息的文档。

关于azure - 如何将范围和 ApplicationURI 添加到 Azure AD 应用程序注册?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/71413186/

34 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com