編集

次の方法で共有


New-AzApiManagementUserToken

Generates a Shared Access Token for the User.

Syntax

New-AzApiManagementUserToken
   -Context <PsApiManagementContext>
   -UserId <String>
   [-KeyType <PsApiManagementUserKeyType>]
   [-Expiry <DateTime>]
   [-DefaultProfile <IAzureContextContainer>]
   [<CommonParameters>]

Description

The cmdlet New-AzApiManagementUserToken generates a Shared Access Token for a specified User

Examples

Example 1: Generate a Shared Access Token for Git User

$context = New-AzApiManagementContext -ResourceGroupName powershelltest -ServiceName powershellsdkservice
$gitAccess=Get-AzApiManagementTenantAccess -Context $context
New-AzApiManagementUserToken -Context $context -UserId $gitAccess.Id

UserId      TokenExpiry         KeyType UserToken
------      -----------         ------- ---------
integration 5/3/2019 2:02:34 PM Primary integration&201905031402&zOwopJChWAA6oaqGHMyf7Ol9wUCPcrtdmBmff8c2lcmZk9Y...

This script get the Git user configured in ApiManagement service and generates a Shared Access Token using the Primary Key valid for 8 hours.

Example 2

Generates a Shared Access Token for the User. (autogenerated)

New-AzApiManagementUserToken -Context <PsApiManagementContext> -Expiry <DateTime> -UserId <String>

Parameters

-Context

Instance of PsApiManagementContext. This parameter is required.

Type:PsApiManagementContext
Position:Named
Default value:None
Required:True
Accept pipeline input:True
Accept wildcard characters:False

-DefaultProfile

The credentials, account, tenant, and subscription used for communication with Azure.

Type:IAzureContextContainer
Aliases:AzContext, AzureRmContext, AzureCredential
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-Expiry

Expiry of the Token. If not specified, the token is created to expire after 8 hours. This parameter is optional.

Type:Nullable<T>[DateTime]
Position:Named
Default value:None
Required:False
Accept pipeline input:True
Accept wildcard characters:False

-KeyType

User Key to use when generating the Token. This parameter is optional.

Type:PsApiManagementUserKeyType
Accepted values:Primary, Secondary
Position:Named
Default value:None
Required:False
Accept pipeline input:True
Accept wildcard characters:False

-UserId

Identifier of existing user. This parameter is required.

Type:String
Position:Named
Default value:None
Required:True
Accept pipeline input:True
Accept wildcard characters:False

Inputs

PsApiManagementContext

String

PsApiManagementUserKeyType

Nullable<T>[[System.DateTime, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]]

Outputs

PsApiManagementUserToken