I have an Azure AD Service Principal which is the admin of a Azure SQL Database. There is a PowerBI dashboard with a DataSource that connects to the Database. After publishing the dashboard programmatically (CI/CD), I need to update the parameters and the Datasource credentials.
Considering the examples from the documentation, what credentialDetails
definition is required to authenticate to Azure SQL Server using a Service Principal client id and credential?
The only way I managed to have access with the SP was using OAuth2
with an accessToken
for the database scope. However, the token expires in 1 hour which would force a redeployment of the dashboard continuously.
{
"credentialDetails": {
"credentialType": "OAuth2",
"credentials": "{\"credentialData\":[{\"name\":\"accessToken\", \"value\":\"eyJ0....fwtQ\"}]}",
"encryptedConnection": "Encrypted",
"encryptionAlgorithm": "None",
"privacyLevel": "None"
}
}
Using Azure AD Service Principal authentication is required for compliance policies within the company.
Example of the error message when using Basic
credential type is used:
{
"error":{
"code":"DM_GWPipeline_Gateway_DataSourceAccessError",
"pbi.error":{
"code":"DM_GWPipeline_Gateway_DataSourceAccessError",
"parameters":{
},
"details":[
{
"code":"DM_ErrorDetailNameCode_UnderlyingErrorCode",
"detail":{
"type":1,
"value":"-2146232060"
}
},
{
"code":"DM_ErrorDetailNameCode_UnderlyingErrorMessage",
"detail":{
"type":1,
"value":"Login failed for user 'aad_app_name'. Reason: Azure Active Directory only authentication is enabled. Please contact your system administrator."
}
},
{
"code":"DM_ErrorDetailNameCode_UnderlyingHResult",
"detail":{
"type":1,
"value":"-2146232060"
}
},
{
"code":"DM_ErrorDetailNameCode_UnderlyingNativeErrorCode",
"detail":{
"type":1,
"value":"18456"
}
}
],
"exceptionCulprit":1
}
}
}