Esempio n. 1
0
        static IPowerBIClient CreateClient(PowerBIToken token, string accessKey, string apiUrl)
        {
            WorkspaceCollectionKeys accessKeys = new WorkspaceCollectionKeys()
            {
                Key1 = accessKey
            };

            // Generate a JWT token used when accessing the REST APIs
            var jwt = token.Generate(accessKeys.Key1);

            // Create a token credentials with "AppToken" type
            var credentials = new TokenCredentials(jwt, "AppToken");

            // Instantiate your Power BI client passing in the required credentials
            var client = new PowerBIClient(credentials);

            // Override the api endpoint base URL.  Default value is https://api.powerbi.com
            client.BaseUri = new Uri(apiUrl);

            return(client);
        }
Esempio n. 2
-2
        static IPowerBIClient CreateClient(PowerBIToken token, string accessKey, string apiUrl)
        {
            WorkspaceCollectionKeys accessKeys = new WorkspaceCollectionKeys()
            {
                Key1 = accessKey
            };

            // Generate a JWT token used when accessing the REST APIs
            var jwt = token.Generate(accessKeys.Key1);

            // Create a token credentials with "AppToken" type
            var credentials = new TokenCredentials(jwt, "AppToken");

            // Instantiate your Power BI client passing in the required credentials
            var client = new PowerBIClient(credentials);

            // Override the api endpoint base URL.  Default value is https://api.powerbi.com
            client.BaseUri = new Uri(apiUrl);

            return client;
        }