Share via


New-PartnerAccessToken

Acquires an access token from the authority.

Syntax

New-PartnerAccessToken
   -ApplicationId <String>
   [-Consent]
   [-Environment <EnvironmentName>]
   [-RefreshToken <String>]
   [-Resource <String>]
   [-TenantId <String>]
   [<CommonParameters>]
New-PartnerAccessToken
   [-ApplicationId <String>]
   [-Consent]
   -Credential <PSCredential>
   [-Environment <EnvironmentName>]
   [-RefreshToken <String>]
   [-Resource <String>]
   -TenantId <String>
   [<CommonParameters>]

Description

The New-PartnerAccessToken can be used to request new access tokens.

Examples

Example 1

PS C:\> $appId = '<AAD-AppId>'
PS C:\> $appSecret = '<AAD-AppSecret>' | ConvertTo-SecureString -AsPlainText -Force
PS C:\> $credential = New-Object System.Management.Automation.PSCredential $appId, $appSecret
PS C:\> New-PartnerAccessToken -Credential $credential -TenantId '<TenantId>'

Generates a new access token using a service principal for authentication.

Example 2

PS C:\> $credential = Get-Credential
PS C:\> New-PartnerAccessToken -ApplicationId '<AAD-AppId>' -Credential $credential -TenantId '<TenantId>'

Generate a new access token using user credentials for authentication.

Parameters

-ApplicationId

The identifier for the Azure AD application.

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

A flag that indicates that the intention is to perform the partner consent process.

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

-Credential

Credentials that represents the service principal.

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

-Environment

Name of the environment to be used during authentication.

Type:EnvironmentName
Aliases:EnvironmentName
Accepted values:GlobalCloud, ChinaCloud, GermanCloud, PPE, USGovernment
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-RefreshToken

The refresh token to use in the refresh flow.

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

-Resource

The identifier of the target resource that is the recipient of the requested token.

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

-TenantId

The identifier of the Azure AD tenant.

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

Inputs

None

Outputs

Microsoft.Store.PartnerCenter.Models.Authentication.AuthenticationResult