[BUG] Managed Identity and SubmitTransactionAsync causes AtomFormatNotSupported exception
See original GitHub issueDescribe 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
- Create User Assigned identity and give it the [Storage Table Data Contributor] role on the table
- Connect to Storage Table with ClientId from previous step
- 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:
- Created 2 years ago
- Comments:9 (5 by maintainers)
Top GitHub Comments
This fix will be in next months package release.
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 ?