Installing MSOnline is pretty Simple.
Open PowerShell in Elevated Mode and run the command,
Set-ExecutionPolicy -ExecutionPolicy unrestricted
Install-Modue -Name MSOnline
By Default, When you run the command
You will get connected to Global Tenant ( Public Cloud)
What if you have 21Vianet operated Office 365 Azure Active Directory using PowerShell. You can use below command to connect AzureChinaCloud
Connect-MsolService -AzureEnvironment AzureChinaCloud
Once you have entered password and credentials are validated, you will get MSOnline Module loaded.
Once Connected to 21Vianet Azure AD, You can validate by running the command
What is AzureEnvironment?
Microsoft Hosts Office 365 Cloud for Global(for Public), US Government, German and China. hence connecting the PowerShell also needs to be done for respective Azure Cloud.
If you want to connect other Azure Cloud Environments, Still you will be able to connect using Single MSOnline PowerShell Module using your respective Cloud Environment. Replace the AzureEnvironment based on your respective Azure Cloud to connect,