Monday, May 22, 2017

How to run power shell commands against Skype Online if MFA is enabled - Updated

Regarding my post on Friday May 19th. I have got new information that the lates version of Skype Power shell finally supports modern authentication.


Here is an updated post:
Start to create a new ps1 script like this and then store this ps1 file on e.g C:\SkypeOnline





Notice that I don`t use the old passing the Credentials object. I use the -UserName instead to launch the ADAL.
This will start up Get-CsAccessToken to get token from Azure Active Directory.


Download the latest version of Skype Online Power shell module: (https://www.microsoft.com/en-us/download/details.aspx?id=39366)





Start Skype for Business server management shell



Launch the SkypeOnline.ps1 script



Type in your admin account

In this case a also need to get an SMS with code



Then you can run commands


Thank you very much to Ståle Hansen (https://msunified.net/) who made me aware of this new opportunity

Friday, May 19, 2017

How to run power shell commands against Skype Online if MFA is enabled

Start Power Shell on you local computer





You must have version 3 or higher. To check your version, enter this cmdlet:
Get-Host


You can download a newer version here : https://www.microsoft.com/en-us/download/details.aspx?id=50395


You also need Skype for Business Online, Windows PowerShell Module. To check if you have Skype for Business module, enter this cmdlet:


Get-Module -ListAvailable -Name SkypeOnlineConnector





If there is no result listed, you can download the module her: https://www.microsoft.com/en-us/download/details.aspx?id=39366


If your admin account use MFA, you need to set the app password. If not, you can jump down to the last section and then type your admin password instead.


Log in with your admin account and then set the AppPassword

Click on the "Create" button

Enter "something" and then click on "Next"

Remember this AppPassword

Switch back to your PowerShell windows, and then enter the following cmdlets:
Import-Module SkypeOnlineConnector

$cred = Get-Credential

$SfBSession = New-CsOnlineSession -Credential $cred

Import-PSSession $SfBSession -AllowClobber

Type your AppPassword in this box.


Then you can run commands against Skype Online e.g