O365 Group

Check if PowerBI Workspace exists using Get-UnifiedGroup PowerShell Command

Posted on Updated on

We will validate if Certian PowerBI workspace exists or not using Get-UnifiedGroup PowerShell Command in this link

The Get-UnifiedGroup is a little bit tricky because you cannot Load it unless you setup a Microsoft.Exchange connection through O365, and after than you can use the Get-UnifiedGroup command

The below PowerShell script is connected to O365 Exchange then get the unified Group.

Any PowerBI Workspace created is associated with O365 Group, If the workspace is deleted for any reason, the O365 Group will be deleted accordingly.
The Group Id should be part of the Workspace PowerBI Url as follow:

$Username = "admin@tenant.onmicrosoft.com"
$Password = "P@ssw0rd"
[System.Net.WebRequest]::DefaultWebProxy.Credentials = [System.Net.CredentialCache]::DefaultCredentials
$creds = New-Object System.Management.Automation.PSCredential($Username,(ConvertTo-SecureString $Password -AsPlainText -Force));
$session = New-PSSession -ConfigurationName Microsoft.Exchange -Authentication Basic -ConnectionUri https://ps.outlook.com/powershell -AllowRedirection:$true -Credential $creds
Import-PSSession $session -AllowClobber
Get-UnifiedGroup -Identity 05cb4ff7-7bcb-4f71-a8f9-f9135ed7a577

Please leave a comment if you faced any issues while running this script