Get-AzureStackToken

Gets a token that is used to make calls to the Resource Manager.

Syntax

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

Description

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.

Examples

-------------------------- EXAMPLE 1 --------------------------

$ArmEndpoint = "https://adminmanagement.local.azurestack.external"
$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]
$AadTenantId = "<AAD tenant that you used to deploy Azure Stack>"

Get-AzureStackToken -Authority $aadAuthorityEndpoint -AadTenantId $AadTenantId -Resource $aadResource

Description


The following example gets the access token for the specified user

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.

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

Specifies how this cmdlet responds to an information event. The 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

Specifies a variable that is used for storing an informational message.

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

Specifies a variable that stores the value of the current pipeline element.

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