Logic App query Azure Table using HTTP and Managed Identity authentication

Jorge Rodrigues 181 Reputation points
2022-04-01T16:40:32.573+00:00

Hello all,

I am trying to query Azure Table using the HTTP connector without success.

According to this document managed identity authentication is now possible for Azure Table:
https://learn.microsoft.com/en-us/azure/storage/tables/authorize-managed-identity

I have authorized the managed identity of the consumption logic app in the azure table using PowerShell as the documentation sugests.
https://learn.microsoft.com/en-us/azure/storage/tables/assign-azure-role-data-access?tabs=powershell

New-AzRoleAssignment -ObjectID xxxxxxxxxxxxxxxx `  
    -RoleDefinitionName "Storage Table Data Contributor" `  
    -Scope  "/subscriptions/<subscription>/resourceGroups/<resource-group>/providers/Microsoft.Storage/storageAccounts/<storage-account>/tableServices/default/tables/<table>"  

Then in the logic app I've filled the request as documented in:
https://learn.microsoft.com/en-us/rest/api/storageservices/query-tables#request-headers

189235-image.png

The run fails with forbidden missing authorization header.

    "body": {  
        "odata.error": {  
            "code": "AuthenticationFailed",  
            "message": {  
                "lang": "en-US",  
                "value": "Server failed to authenticate the request. Make sure the value of Authorization header is formed correctly including the signature.\nRequestId:8d5dbe66-d002-0005-26e6-45da23000000\nTime:2022-04-01T16:35:57.2213453Z"  
            }  
        }  
    }  

Any ideas?

Azure Logic Apps
Azure Logic Apps
An Azure service that automates the access and use of data across clouds without writing code.
2,982 questions
0 comments No comments
{count} votes

Accepted answer
  1. MayankBargali-MSFT 69,991 Reputation points
    2022-04-04T11:56:26.137+00:00

    @Jorge Rodrigues Thanks for reaching out. I will suggest you to verify the managed identities with the logic app document and reverify if you have enabled the managed identities and assigned the right permission for which you have performed the operation. I believed you have already verified the same but sharing the same with for the community to validate it.

    As per the screenshot, I can see you have defined x-ms-date with the utcNow() and it is not correctly formatted as per documented here. Please leverage the 2019-02-02 or above x-ms-version so you don't face any authentication issues in case if you have set up the configuration correctly as per the managed identities with the logic app document.

    I have used the below header and I was able to successfully execute the storage table REST API.

    x-ms-date : formatDateTime(utcNow(),'r')  
    x-ms-version : 2021-04-10  
    Accept : application/json;odata=fullmetadata  
    

    189751-image.png

    189722-image.png

    Feel free to get back to me if you need any assistance.


0 additional answers

Sort by: Most helpful