1

I'm trying to figure out whether there is a azure management NuGet package that I can use to communicate with this part of the API for suspending and resuming my powerbi embedded capacities.

I have been unable to find it. Does what I'm looking for exist?

Maurits Moeys
  • 1,116
  • 1
  • 12
  • 22
  • I have exact same requirement, need to Resume PowerBI Embedded in order to process some export reports and after reports are generated and downloaded then Pause the PowerBI embedded capactity again. Actually I would love to do this in a single Azure Function with C# – VAAA Jun 17 '20 at 00:23

1 Answers1

0

Does what I'm looking for exist?

In short, No. As the link you provided, it need azure_auth to access to Power BI Embedded.

You could use the below code to get the access_token and call the rest api you provide.

    private static string redirectUri = "https://login.live.com/oauth20_desktop.srf";
    private static string resourceUri = "https://analysis.windows.net/powerbi/api";
    private static string authorityUri = "https://login.windows.net/common/oauth2/authorize";
    // Obtain at https://dev.powerbi.com/apps
    private static string clientId = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx";

    private static AuthenticationContext authContext = new AuthenticationContext(authorityUri, new TokenCache());

    private async void btnAuthenticate_ClickAsync(object sender, EventArgs e)
    {
        var authenticationResult = await authContext.AcquireTokenAsync(resourceUri, clientId, new Uri(redirectUri), new PlatformParameters(PromptBehavior.Auto));
        if (authenticationResult == null)
            MessageBox.Show("Call failed.");
        else
            MessageBox.Show(authenticationResult.AccessToken);
    }

You can refer to the article about Power BI for .NET. Also you could use powershell to Resume-AzPowerBIEmbeddedCapacity.

Joey Cai
  • 18,968
  • 1
  • 20
  • 30