First you will need to setup a machine to be able to connect to Office 365 Skype for Business Online remotely in PowerShell.
You will require the Skype for Business Online Windows PowerShell Module which you can download here:
You will need to set the execution policy to remote signed. You can use the following PowerShell cmdlet to do so:
Next we will need to build a connection profile. You can use the below example to do this:
#Import the Skype Module
#Set your global admin account (this will prompt for the credentials)
$cred = Get-Credential
#create a session
$sfboSession = New-CsOnlineSession -Credential $cred -Verbose
#start the session
You should now be authenticated and able to run cmdlets for Skype for Business Online.
#Check to see what policies are applied to a given user
Where sip uri could look like this: "FirstName LastName"
Note: MyPolicyName = Your actual Policy Name. You can find the policy names you have in your environment from the On Demand Policy Management for Skype for Business Online policy drop downs.
NOTE: Applying a policy can take some time in o365. It may take upwards to an hour or more to apply the policy. In most cases it is a 10-15 minutes.
Grant-CsClientPolicy Identity "FirstName LastName" -PolicyName "MyPolicyName"
Grant-CsConferencingPolicy -Identity "FirstName LastName" -PolicyName "MyPolicyName"
Grant-CsVoicePolicy -Identity "FirstName LastName" -PolicyName Tag:MyPolicyName
Grant-CsExternalAccessPolicy -Identity "FirstName LastName" -PolicyName "MyPolicyName"
Grant-CsMobilityPolicy -Identity "FirstName LastName" -PolicyName "MyPolicyName"
If applying a policy throws an error in PowerShell, that error will need to be fixed before the tool can properly apply the policies.