Share via


Connect-PartnerCenter

Connect to Partner Center with an authenticated account for use with partner cmdlet requests.

Syntax

User (Default)

Connect-PartnerCenter
    [-Environment <EnvironmentName>]
    [-Tenant <String>]
    [-UseDeviceAuthentication]
    [-WhatIf]
    [-Confirm]
    [<CommonParameters>]

AccessToken

Connect-PartnerCenter
    -AccessToken <String>
    [-Environment <EnvironmentName>]
    [-Tenant <String>]
    [-WhatIf]
    [-Confirm]
    [<CommonParameters>]

RefreshToken

Connect-PartnerCenter
    -ApplicationId <String>
    -RefreshToken <String>
    [-CertificateThumbprint <String>]
    [-Credential <PSCredential>]
    [-Environment <EnvironmentName>]
    [-Tenant <String>]
    [-WhatIf]
    [-Confirm]
    [<CommonParameters>]

ServicePrincipalCertificate

Connect-PartnerCenter
    -ApplicationId <String>
    -CertificateThumbprint <String>
    -Tenant <String>
    [-Environment <EnvironmentName>]
    [-ServicePrincipal]
    [-WhatIf]
    [-Confirm]
    [<CommonParameters>]

ServicePrincipal

Connect-PartnerCenter
    -Credential <PSCredential>
    -Tenant <String>
    [-Environment <EnvironmentName>]
    [-ServicePrincipal]
    [-WhatIf]
    [-Confirm]
    [<CommonParameters>]

Description

The Connect-PartnerCenter cmdlet connects to Partner Center with an authenticated account for use with partner cmdlet requests. After executing this cmdlet, you can disconnect from an Partner Center account using Disconnect-PartnerCenter.

Examples

Example 1

PS C:\> Connect-PartnerCenter

This command connects to a Partner Center account. To run partner cmdlets with this account, you must provide an organizational credentials, that are associated with the Cloud Solution Provider program, at the prompt.

Example 2

PS C:\> $credential = Get-Credential
PS C:\> Connect-PartnerCenter -Credential $credential -Tenant 'xxxx-xxxx-xxxx-xxxx' -ServicePrincipal

The first command gets the service principal credentials (application identifier and service principal secret), and then stores them in the $credential variable. The second command connects to Partner Center using the service principal credentials stored in $credential for the specified Tenant. The ServicePrincipal switch parameter indicates that the account authenticates as a service principal.

Example 3

PS C:\> $refreshToken = '<refreshToken>'
PS C:\> Connect-PartnerCenter -ApplicationId 'xxxx-xxxx-xxxx-xxxx' -RefreshToken $refreshToken

Connects to Partner Center using a refresh token that was generated using a native application.

Example 4

PS C:\> $appId = 'xxxx-xxxx-xxxx-xxxx'
PS C:\> $secret =  ConvertTo-SecureString 'app-secret-here' -AsPlainText -Force
PS C:\> $refreshToken = '<refreshToken>'
PC C:\> $tenantId = 'yyyy-yyyy-yyyy-yyyy'
PS C:\>
PS C:\> $credential = New-Object System.Management.Automation.PSCredential($appId, $secret)
PS C:\>
PS C:\> Connect-PartnerCenter -ApplicationId $appId -Credential $credential -RefreshToken $refreshToken

Connects to Partner Center using a refresh token that was generated using a web application.

Parameters

-AccessToken

The access token for Partner Center.

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

AccessToken
Position:Named
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-ApplicationId

SPN

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

RefreshToken
Position:Named
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False
ServicePrincipalCertificate
Position:Named
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-CertificateThumbprint

Certificate Hash (Thumbprint)

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

RefreshToken
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-Confirm

Prompts you for confirmation before running the cmdlet.

Parameter properties

Type:SwitchParameter
Default value:None
Supports wildcards:False
DontShow:False
Aliases:cf

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-Credential

Application identifier and secret for service principal credentials.

Parameter properties

Type:PSCredential
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

RefreshToken
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-Environment

Environment containing the account to log into.

Parameter properties

Type:EnvironmentName
Default value:None
Accepted values:AzureCloud, AzureChinaCloud, AzureGermanCloud, AzurePPE, AzureUSGovernment
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-RefreshToken

Refresh token used to connect to Partner Center.

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

RefreshToken
Position:Named
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-ServicePrincipal

Indicates that this account authenticates by providing service principal credentials.

Parameter properties

Type:SwitchParameter
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

ServicePrincipalCertificate
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-Tenant

The identifier of the Azure AD tenant.

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False
Aliases:Domain, TenantId

Parameter sets

User
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False
AccessToken
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False
RefreshToken
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-UseDeviceAuthentication

Use device code authentication instead of a browser control

Parameter properties

Type:SwitchParameter
Default value:None
Supports wildcards:False
DontShow:False
Aliases:Device, DeviceAuth, DeviceCode

Parameter sets

User
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-WhatIf

Shows what would happen if the cmdlet runs. The cmdlet is not run.

Parameter properties

Type:SwitchParameter
Default value:None
Supports wildcards:False
DontShow:False
Aliases:wi

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

CommonParameters

This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutBuffer, -OutVariable, -PipelineVariable, -ProgressAction, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.

Inputs

None

Outputs

Microsoft.Store.PartnerCenter.PowerShell.Models.Authentication.PartnerContext