title: PowerBI Embed Service Principal embed token generation error for effective ID
body: <p>I have set up a dedicated PowerBI capacity, added a service principal as an admin to the workspace and am now trying to embed a report that has a direct connection to Azure Analysis Services, authenticating as the service principal.</p>
  <p>When I try to issue an embed token, I am getting an error message &quot;Creating embed token for accessing dataset [my dataset id] requries effective identity username to be identical to the caller's principal name&quot;</p>
  <p>I am using the PowerBI .NET Core package Microsoft.PowerBI.Api, version 3.14.0 from Nuget to try and issue the code, and this is the code:</p>
  <pre><code>GenerateTokenRequest generateTokenRequestParameters;
  //var rls = new EffectiveIdentity(AppObjectId, new List&lt;string&gt; { report.DatasetId });
  var rls = new EffectiveIdentity(ApplicationId, new List&lt;string&gt; { report.DatasetId });
  rls.Roles = new string[] { &quot;AllData&quot; };
  generateTokenRequestParameters = new GenerateTokenRequest(accessLevel: &quot;view&quot;, 
                                       identities: new List&lt;EffectiveIdentity&gt; { rls });
  var tokenResponse = await client.Reports.GenerateTokenInGroupAsync(workspaceId, 
                               report.Id, generateTokenRequestParameters);
  </code></pre>
  <p>Things I have tried:</p>
  <ul>
  <li>Sending the exact same effective ID string as the Service Principal credential (the app id)</li>
  <li>Sending the App Registration Object ID as the effective ID String</li>
  </ul>
  <p>Any ideas to help me troubleshoot this problem?</p>