Connect various M365 services from VScode

Install PowerShell extension in VSCode

Connect to MS Teams from VSCode:

# Open Vscode with admin rights
# In the PowerShell Window, run the following PowerShell commands using Office 365 Admin account credentials: 

Install-Module -Name MicrosoftTeams -Force -AllowClobber
Import-Module -Name MicrosoftTeams 
Connect-MicrosoftTeams
Disconnect-MicrosoftTeams

Connect to Exchange online from VSCode:

# Check the supported version 5.1 and above using below cmdlt

$PSVersionTable 

# Set execution policy to remote signed

Set-ExecutionPolicy RemoteSigned
[Net.ServicePointManager]::SecurityProtocol = [Net.ServicePointManager]::SecurityProtocol -bor [Net.SecurityProtocolType]::Tls12
Install-PackageProvider -Name NuGet -Force
Install-Module PowerShellGet -AllowClobber -Force
Set-PSRepository -Name PSGallery -InstallationPolicy Trusted

# Close PowerShell/Vscode and open again:

Install-Module -Name ExchangeOnlineManagement
Import-Module ExchangeOnlineManagement; Get-Module ExchangeOnlineManagement
Connect-ExchangeOnline -UserPrincipalName admin@cloudmechanics.in

Connect to AzureAD from VSCode:

Install-Module -Name Az -Scope CurrentUser -Repository PSGallery -Force
Install-Module -Name PowerShellGet -Force
Install-Module -Name AzureAD
Import-Module  AzureAD
Connect-AzureAD

Connect to Azure from VSCode:

Az login
This entry was posted in Powershell. Bookmark the permalink.

Leave a Reply

Your email address will not be published.