question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[BUG] Managed Identity and SubmitTransactionAsync causes AtomFormatNotSupported exception

See original GitHub issue

Describe the bug When connecting to Azure Table with TokenCredential/Managed Identity and doing a SubmitTransactionAsync I get confusing “AtomFormatNotSupported” exception. When using full SA connectionstring it works fine. Also, regular AddEntityAsync works fine with Managed Identity.

Expected behavior SubmitTransactionAsync should work when using Managed Identity

Actual behavior (include Exception or Stack Trace) Exception: “Service request failed.\r\nStatus: 415 (Unsupported Media Type)\r\n\r\nContent:\r\n<?xml version=\"1.0\" encoding=\"utf-8\"?><error xmlns="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata\”>AtomFormatNotSupported<message xml:lang="en-US">Atom format is not supported."

To Reproduce

  1. Create User Assigned identity and give it the [Storage Table Data Contributor] role on the table
  2. Connect to Storage Table with ClientId from previous step
  3. Perform a SubmitTransactionAsync

something like this:

      TokenCredential tokenCredential = string.IsNullOrEmpty(Environment.GetEnvironmentVariable("WEBSITE_INSTANCE_ID"))
      ? new DefaultAzureCredential()
      : new ManagedIdentityCredential("Client id for User Assigned Identity");

      var Client = new TableClient(new Uri("url to table"), TableName, tokenCredential);
  
      try
      {
          var addEntitiesBatch = new List<TableTransactionAction>(100);
          foreach (var product in products)
          {
              addEntitiesBatch.Add(new TableTransactionAction(TableTransactionActionType.Add, product));
          }

          var response = await Client.SubmitTransactionAsync(addEntitiesBatch);
      }
      catch (Exception e)
      {
          throw e;
      }

Environment:

  • Name and version of the Library package used: Azure.Data.Tables 12.2.0
  • Hosting platform or OS and .NET runtime version: .NET SDK (reflecting any global.json): Version: 6.0.100-rc.1.21458.32 Commit: d7c22323c4

Runtime Environment: OS Name: Windows OS Version: 10.0.19043 OS Platform: Windows RID: win10-x64 Base Path: C:\Program Files\dotnet\sdk\6.0.100-rc.1.21458.32\

Host (useful for support): Version: 6.0.0-rc.1.21451.13 Commit: d7619cd4b1 … (long list of SDKs)

  • IDE and version : Microsoft Visual Studio Professional 2022 Preview (64-bit) Version 17.0.0 Preview 4.0

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:9 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
christothescommented, Sep 22, 2021

This fix will be in next months package release.

0reactions
jedjohancommented, Sep 22, 2021

Ahh, ok. Sounds reasonable. I looked after ways to set it on the TableClient but couldn’t find any way to force json. As I understand it atom is not supported (on the Table Rest API) since quite a few years back ?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Troubleshoot Azure Automation managed identity issues
This article tells how to troubleshoot and resolve issues when using a managed identity with an Automation account.
Read more >
Known issues with managed identities for Azure resources
In this article. VM fails to start after being moved; Transferring a subscription between Azure AD directories; Error during managed identity ...
Read more >
Tried to get token using Managed Service Identity. An error ...
Exception Message: Tried to get token using Managed Service Identity. Access token could not be acquired. An error occurred while sending the ...
Read more >
Managed Identities with Azure AD (Active Directory) Tutorial
Azure AD Managed Identities are one of the best features when it comes to authentication across multiple Azure services.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found