MS Entra authentication for PowerBI (on-premise)
Prerequisites
- Alvao on-premise installation (for SaaS edition, see Implementing Power BI for SaaS)
- MS Entra authentication to Alvao
- AlvaoRestApi accessible from internet
- Custom domain verified in MS Entra Custom Domains
- Power BI Desktop updated to the newest version
Setting up IIS
First, we need to create and set dedicated copy of AlvaoRestApi application to serve reporting data.
-
In Application Pools - Add Application Pool:
- Name: AlvaoRestApiReports AppPool
- All other settings (eg. AppPool identity) set the same as for the AlvaoRestApi AppPool
-
In Sites – Default Web Site – Add Application:
- Alias: AlvaoRestApiReports
- Application pool: AlvaoRestApiReports App Pool
- Physical path: same as for the AlvaoRestApi app (eg. C:\inetpub\wwwroot\AlvaoRestApi)
- Click OK
-
Go to
<your server>/AlvaoRestApiReportsand ensure that application is running OK. It should return same information as a standard AlvaoRestApi. -
Make AlvaoRestApiReports accessible from your public domain, eg. https://contoso.com/AlvaoRestApiReports
-
In the installation path of the AlvaoRestApi (eg. C:\inetpub\wwwroot\AlvaoRestApi) open web.config and remove line:
<environmentVariable name="ASPNETCORE_ENVIRONMENT" value="Production" /> -
Open Command prompt as an administrator and run following commands:
cd C:\Windows\system32\inetsrv
.\appcmd.exe set config -section:system.applicationHost/applicationPools /+"[name='AlvaoRestApiReports AppPool'].environmentVariables.[name='ASPNETCORE_ENVIRONMENT',value='Reports']"
.\appcmd.exe set config -section:system.applicationHost/applicationPools /+"[name='AlvaoRestApi AppPool'].environmentVariables.[name='ASPNETCORE_ENVIRONMENT',value='Production']"
You can check the ASPNETCORE_ENVIRONMENT variables for the app pools using following command:
.\appcmd.exe list apppool "AlvaoRestApi AppPool" /config
.\appcmd.exe list apppool "AlvaoRestApiReports AppPool" /config
Setting up MS Entra
We need to create a new app registration in MS Entra that will be used just for authentication in Power BI.
-
In App Registrations – Register an application
- Name: AlvaoRestApi Reports
-
In AlvaoRestApiReports – Expose an API
- Set Application ID URL to public url of AlvaoRestApiReports app, eg. https://contoso.com/AlvaoRestApiReports
noteYou need to verify your domain ownership in Domain Names service first
-
Add a scope
- Name: Reports
- Who can consent?: Admins and users
- Admin consent display name: Alvao Reports
- Admin consent description: Allows users to connect to Alvao Reports
- State: Enabled
-
**Add a client application: **
- ClientID: b52893c8-bc2e-47fc-918b-77022b299bbc
- Authorized scopes: select previously added scope
- Note: This is confidential client, used in Power BI service
-
Add a client application:
- ClientID: a672d62c-fc7b-4e81-a576-e60dc46e951d
- Authorized scopes: select previously added scope
- Note: This is public client, used in Power BI Desktop and the gateway.
Finish the configuration
- In the installation path of the AlvaoRestApi create a new file appsettings.Reports.json with:
- attribute AAD_ApplicationId set to Application (client) ID of AlvaoRestApi Reports app registration created in the previous steps
- attribute AAD_AdditionalAudience set to Set Application ID URL from your app registration, eg:
{
"AAD_ApplicationId": "f3adada9-c73e-4b86-b30e-c86bc6ce0a93",
"AAD_AdditionalAudience": "https://contoso.com/AlvaoRestApiReports",
}
-
Open AlvaoRestApiReports/v1/systemSettings (eg. https://contoso.com/AlvaoRestApiReports/v1/systemSettings) in a browser and check that addClientId in the response is set to AAD_ApplicationId from the previous step
-
Do the same check for the /AlvaoRestApi, it should return clientId set in the AzureApplicationId property.
Load data to PowerBI report
Follow on-premise procedure in Power BI report templates, connect your report to AlvaoRestApiReports (eg. https://contoso.com/AlvaoRestApiReports) app created in the previous steps.