Get-​Azure​Stack​Token

The Get-AzureStackToken cmdlet gets a token to be used to make calls to Azurestack Resource Manager. The cmdlet will be deprecated in a future release

Syntax

Get-AzureStackToken
   [-Authority] <String>
   -AadTenantId <String>
   [-ClientId <String>]
   [-Credential <PSCredential>]
   [-InformationAction <ActionPreference>]
   [-InformationVariable <String>]
   [-PipelineVariable <String>]
   -Resource <String>
   [<CommonParameters>]
Get-AzureStackToken
   [-Authority] <String>
   [-ClientId <String>]
   [-Credential <PSCredential>]
   [-InformationAction <ActionPreference>]
   [-InformationVariable <String>]
   [-PipelineVariable <String>]
   [-Resource <String>]
   [<CommonParameters>]

Examples

Example 1:

Get-AzureStackToken -Authority $aadAuthorityEndpoint -AadTenantId $AadTenantId -Resource $aadResource -Credential (Get-Credential) -Verbose

Description

-----------

The following example gets the access token for the specified user $endpoints = Invoke-RestMethod -Method Get -Uri "$($ArmEndpoint.TrimEnd('/'))/metadata/endpoints?api-version=2015-01-01" -Verbose $aadAuthorityEndpoint = $endpoints.authentication.loginEndpoint $aadResource = $endpoints.authentication.audiences[0]

Get-AzureStackToken -Authority $aadAuthorityEndpoint -AadTenantId $AadTenantId -Resource $aadResource -Credential (Get-Credential) -Verbose

Required Parameters

-AadTenantId

Azure active directory(AAD) tenant Id of the user belonging to the AAD tenant group

Type:String
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-Authority

Authority endpoint for authentication, typically of the form https://login.windows.net. The value can be obtained by access the ARM metadata endpoint https://<ArmUri>/metadata/endpoints?api-version=2015-01-01 and reading the value of loginEndpoint

Type:String
Position:1
Default value:None
Accept pipeline input:False
Accept wildcard characters:False

Optional Parameters

-ClientId

The ClientId parameter is optional. This parameter will be removed in a future release. Please omit this

Type:String
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-Credential

Specifies the credential for the user for whom we need the access token

Type:PSCredential
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-InformationAction

Not SpecifiedThe following values are permitted for this object type.

Type:ActionPreference
Aliases:infa
Parameter Sets:SilentlyContinue, Stop, Continue, Inquire
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-InformationVariable

Not Specified

Type:String
Aliases:iv
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-PipelineVariable

Not Specified

Type:String
Aliases:pv
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-Resource

Resource value for authentication, The value can be obtained by access the ARM metadata endpoint https://<ArmUri>/metadata/endpoints?api-version=2015-01-01 and reading the value of audiences

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

Outputs

System.Object