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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
jm420a
Frequent Visitor

Authenticating to Azure after Retrieving API Key

Greetings, 
 I have the below code, which each step passes the correct information, however, I'm still asked to specify my credentials. 
On the #Authorization line I pass the access_token from the recently retrieved POST request, and stepping through the applied steps, it retrieves the correct value.  Everything seems to work okay, other than the authentication piece. 

If anyone has any insight on this, I would greatly appreciate it. 

 

 

let
    // Define your Microsoft Graph API URL for audit logs
    apiUrl = "https://graph.microsoft.com/v1.0/auditLogs/directoryAudits",
    //Get value of access_token from Post Request
    AccessToken = fnGetAzureToken{0}[access_token],

    // Define the required headers (you may need to add more headers as necessary)
    headers = [
        #"Authorization" = "Bearer " & AccessToken,
        #"Content-Type" = "application/json"
    ],

    // Create the HTTP request
    auditLogsRequest = Web.Contents(apiUrl, [Headers=headers]),

    // Parse the JSON response
    auditLogsResponse = Json.Document(auditLogsRequest)
in
    auditLogsResponse

 

 

 

0 REPLIES 0

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

Check out the June 2025 Power BI update to learn about new features.

June 2025 community update carousel

Fabric Community Update - June 2025

Find out what's new and trending in the Fabric community.

Top Solution Authors