Connect-PartnerCenter
Connect to Partner Center with an authenticated account for use with partner cmdlet requests.
Syntax
Connect-PartnerCenter
[-Environment <EnvironmentName>]
[-Tenant <String>]
[-UseDeviceAuthentication]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
Connect-PartnerCenter
-AccessToken <String>
[-Environment <EnvironmentName>]
[-Tenant <String>]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
Connect-PartnerCenter
-ApplicationId <String>
[-CertificateThumbprint <String>]
[-Credential <PSCredential>]
[-Environment <EnvironmentName>]
-RefreshToken <String>
[-Tenant <String>]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
Connect-PartnerCenter
-ApplicationId <String>
-CertificateThumbprint <String>
[-Environment <EnvironmentName>]
[-ServicePrincipal]
-Tenant <String>
[-WhatIf]
[-Confirm]
[<CommonParameters>]
Connect-PartnerCenter
-Credential <PSCredential>
[-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
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.
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: | True |
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 |
-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