Showing results for 
Search instead for 
Did you mean: 
Regular Visitor

Embed for customers- Fail to initialize - Could not resolve cluster



I am trying to use PowerBi Embeded in our application for our customers, however I get the following:


> Json Object
"message": "LoadReportFailed",
"detailedMessage": "Fail to initialize - Could not resolve cluster",
"errorCode": "403",
"level": 6,
"technicalDetails": {
"requestId": "5ccfb85d-9a69-49b4-b80f-1706f36bd590"


What am I doing?

This is my app settings:

"AppSettings": {
    "AuthorityUri": "",
    "ResourceUrl": "",
    "RedirectUrl": "http://localhost:21638",
    "ApiUrl": "",
    "ApplicationId": "MYAPPLICATIONID",
    "LoggingRequestUrl": "",
    "GroupId": "MY WORKSPACE ID",
    "ReportID": "MY REPORTID",
    "ApplicationSecret": "MY APP SECRET",
    "Password": "MY PASSWORD"

I get the Token using:

            var authorityUrl = $"";

            var oauthEndpoint = new Uri(authorityUrl);

            using (var client = new HttpClient())
                var result = await client.PostAsync(oauthEndpoint, new FormUrlEncodedContent(new[]
                     new KeyValuePair<string, string>("resource", AppSettings.ResourceUrl),
                     new KeyValuePair<string, string>("client_id", AppSettings.ApplicationId),
                     new KeyValuePair<string, string>("client_secret", AppSettings.ApplicationSecret),
                     new KeyValuePair<string, string>("grant_type", "password"),
                     new KeyValuePair<string, string>("username", AppSettings.Username),
                     new KeyValuePair<string, string>("password",AppSettings.Password),
                     new KeyValuePair<string, string>("scope", "openid"),

                var content = await result.Content.ReadAsStringAsync();

                var authenticationResult = JsonConvert.DeserializeObject<OAuthResult>(content);
                return (new TokenCredentials(authenticationResult.AccessToken, "Bearer"), authenticationResult.AccessToken);

I then do the following:

 using (var powerBiClient = new PowerBIClient(new Uri(AppSettings.ApiUrl), credential.tokenCredentials))
                var powerBiReport = powerBiClient.Reports.GetReportInGroup(AppSettings.GroupId, reportId);

                if (powerBiReport != null)
                    var rowLevelSecurityIdentity = new List<EffectiveIdentity>
                                                           new EffectiveIdentity(name,
                                                               roles: new List<string> {role},
                                                               datasets: new List<string> {powerBiReport.DatasetId})
                    var powerBiTokenRequestParameters = new GenerateTokenRequest("view", powerBiReport.DatasetId, identities: rowLevelSecurityIdentity);

                    var powerBiTokenResponse = powerBiClient.Reports.GenerateTokenInGroup(AppSettings.GroupId,powerBiReport.Id, powerBiTokenRequestParameters);

                    powerBIModel.EmbedUrl = powerBiReport.EmbedUrl;
                    powerBIModel.ReportId = powerBiReport.Id;
                    powerBIModel.AccessToken = powerBiTokenResponse.Token;

  • I have set up the resource and the dedicated capacity in Azure
  • I have the diamond showing on the Workspace in PowerBi
  • I am the master user and I also have a PowerBi Pro account
  • It manages to get embed Url and access token but nothing shows up. I run the embed url, access token and report Id on the power bi playground site and get the error json above.

Can anyone help please?



Frequent Visitor

LoadReportFailedFail to initialize - Couldn't resolve cluster403* Bad access token * Embed type doesn't match token type


As per


My code is pretty similar and it works:


public async Task<AzureToken> GetAzureTokenDataAsync()
			string authorityUrl = $"{_azureSettings.Instance}{_azureSettings.TenantId}/oauth2/token";

			Uri oauthEndpoint = new Uri(authorityUrl);

			using (HttpClient httpClient = new HttpClient())
				HttpResponseMessage responseMessage = await httpClient.PostAsync(oauthEndpoint, new FormUrlEncodedContent(new[]
					 new KeyValuePair<string, string>("resource", _powerBiSettings.ResourceUrl),
					 new KeyValuePair<string, string>("client_id", _azureSettings.ClientId),
					 new KeyValuePair<string, string>("grant_type", "password"),
					 new KeyValuePair<string, string>("username", _powerBiSettings.Username),
					 new KeyValuePair<string, string>("password", _powerBiSettings.Password),
					 new KeyValuePair<string, string>("scope", "openid"),

				string responseText = await responseMessage.Content.ReadAsStringAsync();

				OAuthResult authenticationResult = JsonConvert.DeserializeObject<OAuthResult>(responseText);

				TokenCredentials tokenCredentials = new TokenCredentials(authenticationResult.AccessToken, "Bearer");

				return new AzureToken(tokenCredentials, authenticationResult.AccessToken);

		private class OAuthResult
			public string TokenType { get; set; }

			public string Scope { get; set; }

			public int ExpiresIn { get; set; }

			public int ExtExpiresIn { get; set; }

			public int ExpiresOn { get; set; }

			public int NotBefore { get; set; }

			public Uri Resource { get; set; }

			public string AccessToken { get; set; }

			public string RefreshToken { get; set; }

public async Task<EmbeddedReportConfig> GetReportForIdAsync(Guid reportId, string name, string roles)
			var result = new EmbeddedReportConfig();

				AzureToken azureToken = await _authenticationHandler.GetAzureTokenDataAsync();

				using (PowerBIClient powerBiClient = new PowerBIClient(new Uri(_powerBiSettings.ApiUrl), azureToken.TokenCredentials))
					Report powerBiReport = await powerBiClient.Reports.GetReportAsync(_powerBiSettings.WorkspaceId, reportId.ToString());

					List<EffectiveIdentity> rowLevelSecurityIdentity = new List<EffectiveIdentity>
						new EffectiveIdentity(
							//roles: new List<string> { role },
							datasets: new List<string> {powerBiReport.DatasetId}

					GenerateTokenRequest powerBiTokenRequestParameters = new GenerateTokenRequest("View", powerBiReport.DatasetId, false, rowLevelSecurityIdentity);

					EmbedToken powerBiTokenResponse = await powerBiClient.Reports.GenerateTokenInGroupAsync(_powerBiSettings.WorkspaceId, powerBiReport.Id, powerBiTokenRequestParameters);

					return new EmbeddedReportConfig
						Id = powerBiReport.Id,
						Name = powerBiReport.Name,
						EmbedUrl = powerBiReport.EmbedUrl,
						AccessToken = powerBiTokenResponse.Token
			catch (HttpOperationException ex)
				//Bad Request
				var content = ex.Response.Content;

				return null;

There is also this I hope this helps. 

Helpful resources

Join Arun Ulag at MPPC23

Join Arun Ulag at MPPC23

Get a sneak peek into this year's Power Platform Conference Keynote.

PBI Sept Update Carousel

Power BI September 2023 Update

Take a look at the September 2023 Power BI update to learn more.

Learn Live

Learn Live: Event Series

Join Microsoft Reactor and learn from developers.

Dashboard in a day with date

Exclusive opportunity for Women!

Join us for a free, hands-on Microsoft workshop led by women trainers for women where you will learn how to build a Dashboard in a Day!