question

achrafdridi-4443 avatar image
0 Votes"
achrafdridi-4443 asked MayankBargali-MSFT answered

Azure Function app works fine in local but don't read the request body when deployed in Azure

Hi, I am working with Azure function app that helps upload file to blob storage from file url , I test the function locally using vs code and it works fine and does the job but when deploying in azure and after enabling the identity system assign i tried to trigger it , i can see it gets the credential token because I am using DefaultAzureCredential(). but in the post request I see in logs "No body was attached to request" can someone helps me with this error. thank you ![193818-capture.png][1] [1]: /answers/storage/attachments/193818-capture.png

azure-functions
· 2
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Hi, anonymous user

The following article details how it is used by Managed ID, DefaultAzureCredential, and BlobServiceClient.

https://docs.microsoft.com/en-us/samples/azure-samples/functions-storage-managed-identity/using-managed-identity-between-azure-functions-and-azure-storage/

Is Identity configured?
Are you using BlobServiceClient?

0 Votes 0 ·

I already configured the identity and set it to On. I am working with bloServiceClient where I get the connection string of certain storage account using

storage_client = StorageManagementClient(credentials, subscription_id)

keys = storage_client.storage_accounts.list_keys(RESOURCE_GROUP_NAME,AzureStorageAccount)
AzureStorageAccessKey = keys.keys[0].value

connection_str = "DefaultEndpointsProtocol=https;AccountName=" +AzureStorageAccount + ";AccountKey=" + AzureStorageAccessKey + ";EndpointSuffix=core.windows.net"

and then i do the upload.

I checked the documentation and I have a question . is it necessary to add Azure role assignments and permissions to target storage account noting that in the Function app I get the connection string and access keys of the storage account

0 Votes 0 ·
MayankBargali-MSFT avatar image
0 Votes"
MayankBargali-MSFT answered

anonymous user Thanks for reaching out. As per your screenshot shared, I can see there was error executing your function app but I don't see the exception message/details why the function execution was failed. The exception details should have more details on the failure. But in case if you don't see the stack trace then I will suggest you to review the application insights logs to find the root cause of the failure. You can also refer to Diagnose and solve problem blade to find more details and the action plan to resolve the issue.

As you are using the DefaultAzureCredential() so you should assignee the role correctly for the user assigned/system assigned identity.

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

achrafdridi-4443 avatar image
0 Votes"
achrafdridi-4443 answered MayankBargali-MSFT commented

Hi, thank you for your answer, after publishing this question I added some "try exception" and I find out that the exception was in this line :

keys = storage_client.storage_accounts.list_keys(RESOURCE_GROUP_NAME,AzureStorageAccount)

I thnik I have a problem with system assigned identity, because I am using the subscription of another user " kinda shared his subscription to my microsoft account" and I don't have permissions to to assign the role correctly.


· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

anonymous user Thanks for your response and glad to know that you were able to find the root cause of the issue.

0 Votes 0 ·