Connect-PartnerCenter
Connect to Partner Center with an authenticated account for use with partner cmdlet requests.
Syntax
Connect-PartnerCenter
[-EnforceMFA]
[-Environment <EnvironmentName>]
[-Tenant <String>]
[-UseDeviceAuthentication]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
Connect-PartnerCenter
-AccessToken <String>
[-EnforceMFA]
[-Environment <EnvironmentName>]
[-Tenant <String>]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
Connect-PartnerCenter
-ApplicationId <String>
[-CertificateThumbprint <String>]
[-Credential <PSCredential>]
[-EnforceMFA]
[-Environment <EnvironmentName>]
-RefreshToken <String>
[-Tenant <String>]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
Connect-PartnerCenter
-ApplicationId <String>
[-CertificateThumbprint <String>]
[-EnforceMFA]
[-Environment <EnvironmentName>]
[-ServicePrincipal]
-Tenant <String>
[-WhatIf]
[-Confirm]
[<CommonParameters>]
Connect-PartnerCenter
-Credential <PSCredential>
[-EnforceMFA]
[-Environment <EnvironmentName>]
[-ServicePrincipal]
-Tenant <String>
[-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: Use an interactive login to connect to a Partner Center account
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: Connect to Partner Center using a service principal account
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: Connect to Partner using an access token
PS C:\> $credential = Get-Credential
PS C:\> $refreshToken = '<refreshToken>'
PS C:\> $token = New-PartnerAccessToken -ApplicationId 'xxxx-xxxx-xxxx-xxxx' -Credential $credential -RefreshToken $refreshToken -Scopes "https://api.partnercenter.microsoft.com/user_impersonation" -Tenant 'xxxx-xxxx-xxxx-xxxx'
PS C:\> Connect-PartnerCenter -AccessToken $token.AccessToken
The first command gets the service principal credentials (application identifier and service principal secret), and then stores them in the $credential variable. The third command generates a new access token using the specified refresh token. The final command connects to Partner Center using the access token stored in $token.AccessToken for authentication. The ServicePrincipal switch parameter indicates that the refresh token was generated using a confidential client.
Parameters
-AccessToken
The access token for Partner Center.
Type: | String |
Position: | Named |
Default value: | None |
Required: | True |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-ApplicationId
SPN
Type: | String |
Position: | Named |
Default value: | None |
Required: | True |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-CertificateThumbprint
Certificate Hash (Thumbprint)
Type: | String |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-Confirm
Prompts you for confirmation before running the cmdlet.
Type: | SwitchParameter |
Aliases: | cf |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-Credential
Application identifier and secret for service principal credentials.
Type: | PSCredential |
Position: | Named |
Default value: | None |
Required: | True |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-EnforceMFA
A flag indicating whether or not multi-factor authentication is enforced. The is only configurable while the Partner Center API is not requiring multi-factor authentication.
Type: | SwitchParameter |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-Environment
Environment containing the account to log into.
Type: | EnvironmentName |
Accepted values: | AzureCloud, AzureChinaCloud, AzureGermanCloud, AzurePPE, AzureUSGovernment |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-RefreshToken
Refresh token used to connect to Partner Center.
Type: | String |
Position: | Named |
Default value: | None |
Required: | True |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-ServicePrincipal
Indicates that this account authenticates by providing service principal credentials.
Type: | SwitchParameter |
Position: | Named |
Default value: | None |
Required: | True |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-Tenant
The identifier of the Azure AD tenant.
Type: | String |
Aliases: | Domain, TenantId |
Position: | Named |
Default value: | None |
Required: | True |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-UseDeviceAuthentication
Use device code authentication instead of a browser control
Type: | SwitchParameter |
Aliases: | Device, DeviceAuth, DeviceCode |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-WhatIf
Shows what would happen if the cmdlet runs. The cmdlet is not run.
Type: | SwitchParameter |
Aliases: | wi |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
Inputs
None
Outputs
Microsoft.Store.PartnerCenter.PowerShell.Models.Authentication.PartnerContext