Forum Discussion

Bamak's avatar
Bamak
Helper V
5 years ago
Solved

Manage Access to my Organization Workspaces (Via PowerShell)

Hi,

I'm trying to get the permissions on my workspaces  (Via Powershell (and) API....)
These are the modern workspaces
For example, I would like to see which security group (or UPN)  has the role viewer or member on such or such modern work space ?

I test this power shell script below, but it doesn't return anything correct

 

Ideally ,If a person has a script regarding this need  on  applications, I am also a taker

 

Thanks a lot for any help

 

Best regards and merci 

Christophe

 

 

Import-Module MicrosoftPowerBIMgmt

$password = "XXXXXXXXX" | ConvertTo-SecureString -asPlainText -Force
$username = "XXXXXXXXXX"
$credential = New-Object System.Management.Automation.PSCredential($username, $password)

Connect-PowerBIServiceAccount -Credential $credential
$Session = New-PSSession -ConfigurationName Microsoft.Exchange `
-ConnectionUri https://outlook.office365.com/powershell-liveid/ `
-Credential $credential `
-Authentication Basic `
-AllowRedirection

Import-PSSession $Session


$Groups = Get-UnifiedGroup #-Scope Organization
$Groups | ForEach-Object {
$group = $_
Get-UnifiedGroupLinks -Identity $group.Name -LinkType Members -ResultSize Unlimited | ForEach-Object {
$member = $_
New-Object -TypeName PSObject -Property @{
Member = $member.Name
Group = $group.Name
}
}
} | Export-CSV "C:\\Users\\LLLLLLL\\OneDrive\\Documents\\RRRR\\Power BI\\Administration\PowerShell\\WSPowerBIGroupMembers_unified.csv" -NoTypeInformation -Encoding UTF8

Remove-PSSession $Session

Disconnect-PowerBIServiceAccount