Authenticates the current session with the Partner Center API.
Add-PCAuthentication -CspAppId <String> -CspDomain <String> -Credential <PSCredential> [<CommonParameters>]
Add-PCAuthentication -CspAppId <String> -CspDomain <String> -CspClientSecret <SecureString> [<CommonParameters>]
The Add-PCAuthentication cmdlet sets up authentication for the Partner Center API. Authenticate with either App authentication or App+User authentication to use other cmdlets in this module.
Specifies a application Id generated for the Partner Center account. The application id must match the authentication type chosen.
Required? true
Position? named
Default value
Accept pipeline input? false
Accept wildcard characters? false
Specifies the Partner Center tenant (onmicrosoft.com) domain.
Required? true
Position? named
Default value
Accept pipeline input? false
Accept wildcard characters? false
Specifies an application secret key generated from the Partner Center portal.
Required? true
Position? named
Default value
Accept pipeline input? false
Accept wildcard characters? false
Specifies the user account credentials to use to perform this task. To specify this parameter, you can type a user name, such as User1 or Domain01\User01 or you can specify a PSCredential object. If you specify a user name for this parameter, the cmdlet prompts for a password. You can also create a PSCredential object by using a script or by using the Get-Credential cmdlet. You can then set the Credential parameter to the PSCredential object.
Required? true
Position? named
Default value
Accept pipeline input? false
Accept wildcard characters? false
Some cmdlets require App+User authentication. If you are working with invoices or users, you should use App+User authentication.
$clientSecret = '' $clientSecretSecure = $clientSecret | ConvertTo-SecureString -AsPlainText -Force $cred = Get-Credential
You can obtain the Web App ID and the Client Secret from either Partner Center UI or Azure Active Directory
Set a global token for the script session - App+User authentication
PS C:\>$cred = Get-Credential
PS C:\>Add-PCAuthentication -CspAppId '<native app id GUID>' -CspDomain '<csp partner domain>' -Credential $cred
Set a global token for the script session - App authentication
PS C:\>$clientSecret = '<key code secret>'
PS C:\>$clientSecretSecure = $clientSecret | ConvertTo-SecureString -AsPlainText -Force
PS C:\>Add-PCAuthentication -CspAppId '<web app id GUID>' -CspDomain '<csp partner domain>' -CspClientSecret $clientSecretSecure