Get subscription managed by Office365 Partner
It´s a lot of time i haven´t published anything about Office365 with the use of PowerShell, so today i will not just write about it, but also be writing about helping partners with the Office365 client management.
Actually there are many partners that use some PowerShell commands to manage their client subscriptions to be able to apply changes massively, but not much know about two commands:
Get-MsolPartnerContract and Get-MsolPartnerInformation
So let´s get what these return to us:
- First of all (of course) will be to get our environment prepared for PoweShell and Online services.
- Second thing we´ll do is to start the Microsoft Online Services for Windows PowerShell Module (we´ll find it on the installed program list)
- Once it´s started, run the Connection chain and use your admin credentials as a partner:
$LIveCred = Get-Credential $Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://ps.outlook.com/powershell/ -Credential $LIveCred -Authentication Basic -AllowRedirection Import-PSSession $Session
- Then connect to the MSOL service with the Partner admin credentials once more:
Connect-MsolService
- Once we´re inside the system, run the following command to get a list of the subscription we manage as a Partner:
Get-MsolPartnerContract
The only problem here is that it doesn´t give us a clear output because the only value it returns is the Tenant Id:
So here´s where the other command will help us:
-
The Following command will let us obtain the Info associated to a Tenant Id:
Get-MsolPartnerInformation -TenantId <id>
This would be the result:
The only problema is that we would have to run two commands to get the Info we want and it´s a bit messy, so lets use the functionality and power that PowerShell gives us like the chained commands and use the next command::
Get-MsolPartnerContract | Get-MsolPartnerInformation
This way we will get the Info without the need to investigate about the id that is linked to it.
Hope you Partners find it useful.