Forum Discussion

Zencheg's avatar
Zencheg
Regular Visitor
3 years ago
Solved

Changing datasource credentials (OAuth2) for Paginated reports through REST API

Hi Folks,   I am trying to set OAuth2 credentials for the Paginated reports (RDL) via PowerShell using service account (not SPN) with username/password, but getting 401 response from API:     {...
  • Anonymous's avatar
    Anonymous
    3 years ago

    Hi Zencheg,

    Perhpaps you can try to add the authentications in 'updateDetails' similar as following code: 

     

        "updateDetails": [
            {
                "datasourceName": "{datasource_name}",
                "connectionDetails": {
                    "server": "{server_name}",
                    "database": "{database_name}",
                    "authentication": {
                        "type": "OAuth2",
                        "token": "{oauth2_token}"
                    }
                }
            }
        ]

     

    >>Datasources are Azure SQLs and I am not using gateways at all to access the data, but as I understood, I still need to use some gateways in the query

    That API only work for the datasource which bind to the gateway. When you are handle with one query mixed multiple type of data sources, you can turn on the option to also use gateway to manage data source which not required gateway. (e.g. a dataset include both on premise and cloud data sources)

    Merge or append on-premises and cloud data sources - Power BI | Microsoft Learn

    Regards,

    Xiaoxin Sheng