power bi desktop data loading using graph API error
M query: let apiURL = "https://graph.microsoft.com/v1.0/security/alerts", // Function to get a new access token using the refresh token GetNewAccessToken = () => let tokenUrl = "https://login.microsoftonline.com/" & tenant_id & "/oauth2/v2.0/token", tokenBody = Text.ToBinary( "grant_type=refresh_token" & "&client_id=" & client_id & "&client_secret=" & Uri.EscapeDataString(client_secrets) & "&refresh_token=" & Uri.EscapeDataString(RefreshToken) & "&scope=openid profile offline_access https://graph.microsoft.com/.default" ), tokenResponse = Web.Contents(tokenUrl, [ Headers = [#"Content-Type"="application/x-www-form-urlencoded"], Content = tokenBody ]), tokenJson = Json.Document(tokenResponse), new_access_token = tokenJson[access_token] in new_access_token, // Check if the access token is valid (this is an assumption; replace with your logic if possible) // For demonstration purposes, let's assume we always refresh the token for simplicity. access_token = GetNewAccessToken(), // Create a query string with the new access token authQuery = "?access_token=" & access_token, // Append the query string to the API URL urlWithAuth = apiURL & authQuery, // Make the API request response = Web.Contents(urlWithAuth, [ Headers = [ #"Content-Type" = "application/json" ] ]), // Parse the JSON response to extract the data data = Json.Document(response) in data ERROR DataSource.Error: Web.Contents failed to get contents from 'https://graph.microsoft.com/v1.0/security/alerts?access_token="myaccesstoken" (404): Not Found