Forum Discussion
How to enter SQL server credentials via API?
Hi robzib ,
The first step is to add the gateway connection information. But, to encrypt credentials, see Configure credentials programmatically for Power BI and review the EncryptCredentials .NET Core, Java and Python examples.
POST https://api.powerbi.com/v1.0/myorg/gateways/{gatewayId}/datasources
Gateways - Create Datasource - REST API (Power BI Power BI REST APIs) | Microsoft Docs
Part 2, get the newly added datasource from the result of step 1.
GET https://api.powerbi.com/v1.0/myorg/groups/{groupId}/datasets/{datasetId}/datasources
Datasets - Get Datasources In Group - REST API (Power BI Power BI REST APIs) | Microsoft Docs
Part 3, get the connection information from part 2 and use Update Datasources In Group.
GET https://api.powerbi.com/v1.0/myorg/groups/{groupId}/datasets/{datasetId}/datasources
Datasets - Get Datasources In Group - REST API (Power BI Power BI REST APIs) | Microsoft Docs
Best Regards
Community Support Team _ chenwu zhu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
thank you for your reply. I forgot to mention that my databases are in Azure. From what I understand, gateways are used when we have on-premise databases, or can we use them as well with Azure?
- v-chenwuz-msft3 years agoCommunity Support
Hi robzib ,
No, you can use them with Azure's Vnet gateway and do not need to install the gateway on the Azure VM.
Virtual network (VNet) data gateway architecture | Microsoft Docs
Use virtual network (VNet) data gateway and data sources in Power BI | Microsoft Docs
If you are using Azure SQL database, then you don't need a gateway. Please refer to the following post for the same issue.
Solved: Re: Gateway for Azure SQL Server - Microsoft Power BI Community
Best Regards
Community Support Team _ chenwu zhu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.