你当前正在访问 Microsoft Azure Global Edition 技术文档网站。 如果需要访问由世纪互联运营的 Microsoft Azure 中国技术文档网站,请访问 https://docs.azure.cn。
New-AzApiManagementAuthorizationServer
创建授权服务器。
语法
New-AzApiManagementAuthorizationServer
-Context <PsApiManagementContext>
[-ServerId <String>]
-Name <String>
[-Description <String>]
-ClientRegistrationPageUrl <String>
-AuthorizationEndpointUrl <String>
-TokenEndpointUrl <String>
-ClientId <String>
[-ClientSecret <String>]
[-AuthorizationRequestMethods <PsApiManagementAuthorizationRequestMethod[]>]
-GrantTypes <PsApiManagementGrantType[]>
-ClientAuthenticationMethods <PsApiManagementClientAuthenticationMethod[]>
[-TokenBodyParameters <Hashtable>]
[-SupportState <Boolean>]
[-DefaultScope <String>]
-AccessTokenSendingMethods <PsApiManagementAccessTokenSendingMethod[]>
[-ResourceOwnerUsername <String>]
[-ResourceOwnerPassword <String>]
[-DefaultProfile <IAzureContextContainer>]
[<CommonParameters>]
说明
New-AzApiManagementAuthorizationServer cmdlet 创建 Azure API 管理授权服务器。
示例
示例 1:创建授权服务器
$ApiMgmtContext = New-AzApiManagementContext -ResourceGroupName "Api-Default-WestUS" -ServiceName "contoso"
New-AzApiManagementAuthorizationServer -Context $ApiMgmtContext -Name "Contoso OAuth2 server" -ClientRegistrationPageUrl "https://contoso/signup" -AuthorizationEndpointUrl "https://contoso/auth" -TokenEndpointUrl "https://contoso/token" -ClientId "clientid" -ClientSecret "e041ed1b660b4eadbad5a29d066e6e88" -AuthorizationRequestMethods @('Get', 'Post') -GrantTypes @( 'AuthorizationCode', 'Implicit', 'ResourceOwnerPassword', 'ClientCredentials') -ClientAuthenticationMethods @('Basic') -TokenBodyParameters @{'par1'='val1'; 'par2'='val2'} -AccessTokenSendingMethods @('AuthorizationHeader', 'Query') -ResourceOwnerUsername "ivan" -ResourceOwnerPassword "qwerty"
此命令创建授权服务器。
示例 2
创建授权服务器。 (自动生成)
New-AzApiManagementAuthorizationServer -AccessTokenSendingMethods AuthorizationHeader -AuthorizationEndpointUrl 'https://contoso/auth' -AuthorizationRequestMethods Get -ClientAuthenticationMethods Basic -ClientId 'clientid' -ClientRegistrationPageUrl 'https://contoso/signup' -ClientSecret '0000000000000000000000000000000000000' -Context <PsApiManagementContext> -GrantTypes AuthorizationCode -Name 'Contoso OAuth2 server' -ServerId '0123456789' -TokenBodyParameters @{'par1'='val1'} -TokenEndpointUrl 'https://contoso/token'
参数
-AccessTokenSendingMethods
指定要发送访问令牌的方法数组。 psdx_paramvalues AuthorizationHeader 和 Query。
类型: | PsApiManagementAccessTokenSendingMethod[] |
接受的值: | AuthorizationHeader, Query |
Position: | Named |
默认值: | None |
必需: | True |
接受管道输入: | True |
接受通配符: | False |
-AuthorizationEndpointUrl
指定要对资源所有者进行身份验证并获取授权授权的授权终结点。
类型: | String |
Position: | Named |
默认值: | None |
必需: | True |
接受管道输入: | True |
接受通配符: | False |
-AuthorizationRequestMethods
指定授权请求方法的数组。 有效值为:GET、POST。 默认值为 GET。
类型: | PsApiManagementAuthorizationRequestMethod[] |
接受的值: | Get, Post, Head, Options, Trace, Put, Patch, Delete |
Position: | Named |
默认值: | None |
必需: | False |
接受管道输入: | True |
接受通配符: | False |
-ClientAuthenticationMethods
指定客户端身份验证方法的数组。 psdx_paramvalues基本和正文。
类型: | PsApiManagementClientAuthenticationMethod[] |
接受的值: | Basic, Body |
Position: | Named |
默认值: | None |
必需: | True |
接受管道输入: | True |
接受通配符: | False |
-ClientId
指定开发人员控制台的客户端 ID,即客户端应用程序。
类型: | String |
Position: | Named |
默认值: | None |
必需: | True |
接受管道输入: | True |
接受通配符: | False |
-ClientRegistrationPageUrl
指定客户端注册终结点,以向授权服务器注册客户端并获取客户端凭据。
类型: | String |
Position: | Named |
默认值: | None |
必需: | True |
接受管道输入: | True |
接受通配符: | False |
-ClientSecret
指定作为客户端应用程序的开发人员控制台的客户端机密。
类型: | String |
Position: | Named |
默认值: | None |
必需: | False |
接受管道输入: | True |
接受通配符: | False |
-Context
指定 PsApiManagementContext 对象。
类型: | PsApiManagementContext |
Position: | Named |
默认值: | None |
必需: | True |
接受管道输入: | True |
接受通配符: | False |
-DefaultProfile
用于与 Azure 通信的凭据、帐户、租户和订阅。
类型: | IAzureContextContainer |
别名: | AzContext, AzureRmContext, AzureCredential |
Position: | Named |
默认值: | None |
必需: | False |
接受管道输入: | False |
接受通配符: | False |
-DefaultScope
指定授权服务器的默认范围。
类型: | String |
Position: | Named |
默认值: | None |
必需: | False |
接受管道输入: | True |
接受通配符: | False |
-Description
指定授权服务器的说明。
类型: | String |
Position: | Named |
默认值: | None |
必需: | False |
接受管道输入: | True |
接受通配符: | False |
-GrantTypes
指定授予类型的数组。 psdx_paramvalues
- AuthorizationCode
- ClientCredentials
- 含蓄
- ResourceOwnerPassword
类型: | PsApiManagementGrantType[] |
接受的值: | AuthorizationCode, Implicit, ResourceOwnerPassword, ClientCredentials |
Position: | Named |
默认值: | None |
必需: | True |
接受管道输入: | True |
接受通配符: | False |
-Name
指定要创建的授权服务器的名称。
类型: | String |
Position: | Named |
默认值: | None |
必需: | True |
接受管道输入: | True |
接受通配符: | False |
-ResourceOwnerPassword
指定资源所有者密码。 如果 ResourceOwnerPassword 是由 GrantTypes 参数指定的,则必须指定此参数。
类型: | String |
Position: | Named |
默认值: | None |
必需: | False |
接受管道输入: | True |
接受通配符: | False |
-ResourceOwnerUsername
指定资源所有者用户名。 如果 ResourceOwnerPassword 是由 GrantTypes 参数指定的,则必须指定此参数。
类型: | String |
Position: | Named |
默认值: | None |
必需: | False |
接受管道输入: | True |
接受通配符: | False |
-ServerId
指定要创建的授权服务器的 ID。
类型: | String |
Position: | Named |
默认值: | None |
必需: | False |
接受管道输入: | True |
接受通配符: | False |
-SupportState
指示是否支持 State 参数。
类型: | Nullable<T>[Boolean] |
Position: | Named |
默认值: | None |
必需: | False |
接受管道输入: | True |
接受通配符: | False |
-TokenBodyParameters
使用 application/x-www-form-urlencoded 格式指定其他正文参数。
类型: | Hashtable |
Position: | Named |
默认值: | None |
必需: | False |
接受管道输入: | True |
接受通配符: | False |
-TokenEndpointUrl
指定客户端用来获取访问令牌的令牌终结点 URL,以换取提供授权授予或刷新令牌。
类型: | String |
Position: | Named |
默认值: | None |
必需: | True |
接受管道输入: | True |
接受通配符: | False |
输入
PsApiManagementAuthorizationRequestMethod[]
PsApiManagementClientAuthenticationMethod[]
Nullable<T>[[System.Boolean, System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]]
PsApiManagementAccessTokenSendingMethod[]