Skip to main content
Showing results for 
Search instead for 
Did you mean: 

The ultimate Microsoft Fabric, Power BI, Azure AI & SQL learning event! Join us in Las Vegas from March 26-28, 2024. Use code MSCUST for a $100 discount. Register Now

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

Fabric Community Conference

Microsoft Fabric Community Conference

Join us at our first-ever Microsoft Fabric Community Conference, March 26-28, 2024 in Las Vegas with 100+ sessions by community experts and Microsoft engineering.

February 2024 Update Carousel

Power BI Monthly Update - February 2024

Check out the February 2024 Power BI update to learn about new features.

Fabric Career Hub

Microsoft Fabric Career Hub

Explore career paths and learn resources in Fabric.

Fabric Partner Community

Microsoft Fabric Partner Community

Engage with the Fabric engineering team, hear of product updates, business opportunities, and resources in the Fabric Partner Community.