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
PS D:\github\azure-powershell> $context = New-AzApiManagementContext -ResourceGroupName powershelltest -ServiceName
powershellsdkservice
S D:\github\azure-powershell> $gitAccess=Get-AzApiManagementTenantAccess -Context $context
PS D:\github\azure-powershell> 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 -Expiry -UserId
Parameters
Instance of PsApiManagementContext. This parameter is required.
Type: | PsApiManagementContext |
Position: | Named |
Default value: | None |
Accept pipeline input: | True |
Accept wildcard characters: | False |
The credentials, account, tenant, and subscription used for communication with Azure.
Type: | Microsoft.Azure.Commands.Common.Authentication.Abstractions.Core.IAzureContextContainer |
Aliases: | AzContext, AzureRmContext, AzureCredential |
Position: | Named |
Default value: | None |
Accept pipeline input: | False |
Accept wildcard characters: | False |
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 |
Accept pipeline input: | True |
Accept wildcard characters: | False |
User Key to use when generating the Token. This parameter is optional.
Type: | Microsoft.Azure.Commands.ApiManagement.ServiceManagement.Models.PsApiManagementUserKeyType |
Accepted values: | Primary, Secondary |
Position: | Named |
Default value: | None |
Accept pipeline input: | True |
Accept wildcard characters: | False |
Identifier of existing user. This parameter is required.
Type: | String |
Position: | Named |
Default value: | None |
Accept pipeline input: | True |
Accept wildcard characters: | False |
Inputs
Microsoft.Azure.Commands.ApiManagement.ServiceManagement.Models.PsApiManagementUserKeyType
Nullable<T>[[System.DateTime, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]]
Outputs
Microsoft.Azure.Commands.ApiManagement.ServiceManagement.Models.PsApiManagementUserToken