This repository contains a set of PowerShell commands for administrators and developers to manage Cloud Solution Provider program resources.
Run the following command in an elevated PowerShell session to install the Partner Center module:
Install-Module -Name PartnerCenter
If you have an earlier version of the Partner Center PowerShell modules installed from the PowerShell Gallery and would like to update to the latest version, run the following commands from an elevated PowerShell session.
Note: Update-Module
installs the new version, however, it does not remove the old version.
# Install the latest version of the Partner Center PowerShell module
Update-Module -Name PartnerCenter
To connect to Partner Center, use the Connect-PartnerCenter
command.
The following example demonstrates how to connect using a service principal. Using this approach will leverage the app only authentication flow. It is important to note that not all Partner Center operations support this type of authentication. If you have not already created an Azure AD application then please follow the steps documented in the Web App section below.
# Service principal login
$appId = '<Web-AAD-AppId-for-PartnerCenter>'
$appSecret = '<Web-AAD-AppSecret>' | ConvertTo-SecureString -AsPlainText -Force
$credential = New-Object System.Management.Automation.PSCredential $appId $appSecret
Connect-PartnerCenter -Credential $credential -ServicePrincipal -TenantId '<TenantId>
The following examples demonstrate how to connect using user credentials. Using this approach will leverage the app + user authentication flow. If you have not already configured an Azure AD application for use with this command then please see the steps documented in the Native App section below.
# Interactive login - a dialog box will appear for you to provide your Partner Center credentials
Connect-PartnerCenter -ApplicationId '<Native-AAD-AppId-for-PartnerCenter>'
# Non-interactive login
$PSCredential = Get-Credential
Connect-PartnerCenter -ApplicationId '<Native-AAD-AppId-for-PartnerCenter>' -Credential $PSCredential
The following example demonstrates how to connect using an access token. It is important to note that this type of authentication can leverage either the app only or app + user authentication flows. The example below shows how you can obtain an access token using the app only authentication flow.
$appId = '<AAD-AppId-for-PartnerCenter>'
$appSecret = '<AAD-AppSecret>' | ConvertTo-SecureString -AsPlainText -Force
$PSCredential = New-Object System.Management.Automation.PSCredential $appId $appSecret
$token = New-PartnerAccessToken -Credential $PSCredential -ServicePrincipal -TenantId '<TenantId>'
Connect-PartnerCenter -AccessToken $token.AccessToken -AccessTokenExpiresOn $token.ExpiresOn -ApplicationId '<AAD-AppId-for-PartnerCenter>' -TenantId '<TenantId>'
To log into a specific cloud (ChinaCloud, GlobalCloud, GermanCloud, USGovernment), use the Environment
parameter:
# Log into a specific cloud - in this case, the German cloud
Connect-PartnerCenter -Environment GermanCloud
Use the Get-Command
cmdlet to discover cmdlets within a specific module, or cmdlets that follow a specific search pattern:
# View all cmdlets in the Partner Center module
Get-Command -Module PartnerCenter
# View all cmdlets that contain "Customer" in the PartnerCenter module
Get-Command -Module PartnerCenter -Name "*Customer*"
To view the cmdlet help content, use the Get-Help
cmdlet:
# View the basic help content for Get-PartnerCustomer
Get-Help -Name Get-PartnerCustomer
# View the examples for Get-PartnerCustomer
Get-Help -Name Get-PartnerCustomer -Examples
# View the full help content for Get-PartnerCustomer
Get-Help -Name Get-PartnerCustomer -Full
- Sign in to the Partner Center using credentials that have Admin Agent and Global Admin privileges
- Click on Dashboard at the top of the page, then click on the cog icon in the upper right, and then click the Partner settings.
- Add a new native application if one does not exist already.
- Sign in to the Azure management portal using the same credentials from step 1.
- Click on the Azure Active Directory icon in the toolbar.
- Click App registrations -> Select All apps from the drop down -> Click on the application created in step 3.
- Click Settings and then click Redirect URIs
- Add urn:ietf:wg:oauth:2.0:oob as one of the available Redirect URIs. Be sure to click the Save button to ensure the changes are saved.
- Sign in to the Partner Center using credentials that have Admin Agent and Global Admin privileges
- Click on Dashboard at the top of the page, then click on the cog icon in the upper right, and then click the Partner settings.
- Add a new web application if one does not exist already.