Forum Discussion

frbastos's avatar
frbastos
New Member
4 years ago

How to enable profile permission workspace Power Bi API

Hi guys, could anyone help me?

I'm developing a SAAS (Software as a Service) application and I want to incorporate Power BI.

I'm following the documentation: https://docs.microsoft.com/pt-br/power-bi/developer/embedded/embed-multi-tenancy, but I'm not able to assign permission to the profiles created.

To release the permissions I'm using the Power BI API. To send the request I am using Postman, as shown below:

1) GET https://api.powerbi.com/v1.0/myorg/groups/{{mygroupid}/users
Header: X-PowerBI-Profile-Id=myprofileid
Response:

 

{
    "value": [
        {
            "groupUserAccessRight": "Admin",
            "displayName": "Numpe",
            "identifier": "326de76f-de5d-46ac-aa03-d88a09149723",
            "principalType": "App",
            "profile": {
                "id": "8c04ccc3-ad55-4add-b0b9-5e294dadac69",
                "displayName": "BaruelVanProfile"
            }
        }
    ]
}

 

 

2) PUT https://api.powerbi.com/v1.0/myorg/groups/{{baruelvan_workspace_id}}/users
Without X-PowerBI-Profile-Id Header
Body: 

 

 

{
    "groupUserAccessRight": "Admin",
    "identifier": "326de76f-de5d-46ac-aa03-d88a09149723",
    "principalType": "App",
    "profile": {
        "id": "8c04ccc3-ad55-4add-b0b9-5e294dadac69"
    }
}

 

 

Response:

 

{
    "error": {
        "code": "PowerBIEntityNotFound",
        "pbi.error": {
            "code": "PowerBIEntityNotFound",
            "parameters": {},
            "details": [],
            "exceptionCulprit": 1
        }
    }
}

 

 

3) 2) PUT https://api.powerbi.com/v1.0/myorg/groups/{{baruelvan_workspace_id}}/users
Header: X-PowerBI-Profile-Id=myprofileid
Body:

 

{
    "groupUserAccessRight": "Admin",
    "identifier": "326de76f-de5d-46ac-aa03-d88a09149723",
    "principalType": "App",
    "profile": {
        "id": "8c04ccc3-ad55-4add-b0b9-5e294dadac69"
    }
}

 

Response:

 

{
    "error": {
        "code": "PowerBINotAuthorizedException",
        "pbi.error": {
            "code": "PowerBINotAuthorizedException",
            "parameters": {},
            "details": [],
            "exceptionCulprit": 1
        }
    }
}

 

 

I would like to know what would be the correct way to make the request to allow access to the workspace.