The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredCompete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.
Developing Power bi embedded web-app written in django (python). I retrive workspace, dashboards and report successfully, I also get capacity informations against azure portal , all this by using access token retrived in the following way (using adal python module):
def azure_auth(): context = adal.AuthenticationContext( settings.PBI_AUTHORITY, validate_authority=True, api_version=None) token_response = context.acquire_token_with_username_password( settings.PBI_RESOURCE, settings.PBI_USERNAME, settings.PBI_PASSWORD, settings.PBI_CLIENTID ) aad_token = token_response['accessToken'] headers = {'Authorization': 'Bearer ' + aad_token} return headers
def get_capacities(headers): capacities_request = requests.get( "https://api.powerbi.com/v1.0/myorg/capacities", headers=headers) print("HTTP response:" + str(capacities_request)) obj = json.loads(capacities_request.text) print("capacities: \n" + str(obj))
def resume_pbi_capacity(headers): response = requests.post('https://management.azure.com/subscriptions/SUBSCRIPTION_ID/resourceGroups/RESOURCE_GROUP_NAME/providers/Microsoft.PowerBIDedicated/capacities/CAPACITY_NAME/resume?api-version=2017-10-01', headers) print(response)