If you're an IT professional providing services to Office 365 customers, connecting to Office 365 tenants for your clients can be a bit more complicated than the examples shown previously.
Most commands in the Azure AD PowerShell module will allow you to specify a -TenantId parameter. This is a GUID associated with each of your customer's tenants. But where does this value come from? You can use the Get-MsolPartnerContract to display a list of tenant IDs for the clients you have delegated access to:
Get-MsolPartnerContract -All
Unfortunately, this ID by itself is not very useful. You'll have to combine it somehow with other commands to get something you can identify as a specific client.
For example, the following command will pipe all your customer tenants into a Foreach-Object loop and output the domains associated...