This is best Fabric, Power BI, SQL and AI community event. How do we know? The last event sold out! Save €200 with code FABCMTY200.
Register nowA new Data Days event is coming soon! This time we’re going bigger than ever. Fabric, Power BI, SQL, AI and more. Don't miss out.
Is any way or rest API to get Workspace list by Capacity Name attached ..
TIA
Paritosh Mishra
Solved! Go to Solution.
Capacity names are meaningless. Depending on your tenant admin rights you can either see all workspaces, or you can see the workspaces that you are a member of.
Groups - Get Groups (Power BI Power BI REST APIs) | Microsoft Docs
# Calls the Active Directory Authentication Library (ADAL) to authenticate against AAD
function GetAuthToken
{
if(-not (Get-Module AzureRm.Profile)) {
Import-Module AzureRm.Profile
}
$clientId = "your client id here"
$redirectUri = "urn:ietf:wg:oauth:2.0:oob"
$resourceAppIdURI = "https://analysis.windows.net/powerbi/api"
$authority = "https://login.microsoftonline.com/common/oauth2/authorize";
$authContext = New-Object "Microsoft.IdentityModel.Clients.ActiveDirectory.AuthenticationContext" -ArgumentList $authority
$authResult = $authContext.AcquireToken($resourceAppIdURI, $clientId, $redirectUri, "Auto")
return $authResult
}
# Get the auth token from AAD
$token = GetAuthToken
# Building Rest API header with authorization token
$authHeader = @{
'Content-Type'='application/json'
'Authorization'=$token.CreateAuthorizationHeader()
}
# get workspaces with capacityId where present
$uri = "https://api.powerbi.com/v1.0/myorg/groups"
$v = (Invoke-RestMethod -Uri $uri –Headers $authHeader –Method GET).value
$v | Select id,isReadOnly,isOnDedicatedCapacity,capacityId,name | Format-Table -AutoSize
# Calls the Active Directory Authentication Library (ADAL) to authenticate against AAD
function GetAuthToken
{
if(-not (Get-Module AzureRm.Profile)) {
Import-Module AzureRm.Profile
}
$clientId = "your client id here"
$redirectUri = "urn:ietf:wg:oauth:2.0:oob"
$resourceAppIdURI = "https://analysis.windows.net/powerbi/api"
$authority = "https://login.microsoftonline.com/common/oauth2/authorize";
$authContext = New-Object "Microsoft.IdentityModel.Clients.ActiveDirectory.AuthenticationContext" -ArgumentList $authority
$authResult = $authContext.AcquireToken($resourceAppIdURI, $clientId, $redirectUri, "Auto")
return $authResult
}
# Get the auth token from AAD
$token = GetAuthToken
# Building Rest API header with authorization token
$authHeader = @{
'Content-Type'='application/json'
'Authorization'=$token.CreateAuthorizationHeader()
}
# get workspaces with capacityId where present
$uri = "https://api.powerbi.com/v1.0/myorg/groups"
$v = (Invoke-RestMethod -Uri $uri –Headers $authHeader –Method GET).value
$v | Select id,isReadOnly,isOnDedicatedCapacity,capacityId,name | Format-Table -AutoSize
Did you mean Postmates?
As far as I can see the response is identical.
Sorry for typo mistakes.I have edited my previous msg
Capacity names are meaningless. Depending on your tenant admin rights you can either see all workspaces, or you can see the workspaces that you are a member of.
Groups - Get Groups (Power BI Power BI REST APIs) | Microsoft Docs
When this API "GET https://api.powerbi.com/v1.0/myorg/groups" runs by powershell its return 4 filed
id isReadOnly isOnDedicatedCapacity name
-- ---------- --------------------- ----
5bbca568-2881-4628-a28a-1d2245aea88c False False PowerbiAccessGroup
5e68fde1-5a6b-467b-af41-9775cc32166e False True condecouserdevt011
When same API on "Postman" its resposd body is
Sign up to receive a private message when registration opens and key events begin.
If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.
| User | Count |
|---|---|
| 3 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |