azure-sdk-for-net icon indicating copy to clipboard operation
azure-sdk-for-net copied to clipboard

[BUG] Resource tags updates always fail in AppContainers SDK

Open shibayan opened this issue 2 years ago • 2 comments
trafficstars

Library name and version

Azure.ResourceManager.AppContainers 1.0.1

Describe the bug

Whenever I try to add a resource tag to the Container Apps Managed Environment, it always returns a 409 Conflict error and fails to add it.

Details of the errors returned by the Azure SDK are as follows

Azure.RequestFailedException
  HResult=0x80131500
  Message={"error":{"code":"ManagedEnvironmentOperationInProgress","message":"Cannot modify Container Apps environment cae-acmebot-dev because another operation is in progress."},"code":"ManagedEnvironmentOperationInProgress","message":"Cannot modify Container Apps environment cae-acmebot-dev because another operation is in progress."}
Status: 409 (Conflict)
ErrorCode: ProviderError

Content:
{"error":{"code":"ProviderError","message":"{\"error\":{\"code\":\"ManagedEnvironmentOperationInProgress\",\"message\":\"Cannot modify Container Apps environment cae-acmebot-dev because another operation is in progress.\"},\"code\":\"ManagedEnvironmentOperationInProgress\",\"message\":\"Cannot modify Container Apps environment cae-acmebot-dev because another operation is in progress.\"}"}}

Headers:
Cache-Control: no-cache
Pragma: no-cache
x-ms-failure-cause: REDACTED
x-ms-request-id: 46c24610-2e54-466f-a499-2f1183c511e5
x-ms-correlation-request-id: REDACTED
x-ms-routing-request-id: REDACTED
Strict-Transport-Security: REDACTED
X-Content-Type-Options: REDACTED
Date: Sat, 07 Jan 2023 09:13:18 GMT
Content-Type: application/json; charset=utf-8
Expires: -1
Content-Length: 392

Expected behavior

Resource tags are successfully added.

Actual behavior

Always returns 409 Conflict error and fails to add tags.

Reproduction Steps

var options = new ArmClientOptions
{
    Diagnostics =
    {
        IsLoggingContentEnabled = true,
        IsLoggingEnabled = true
    }
};

var armClient = new ArmClient(new AzureCliCredential(), "<subscription id>", options);

var subscription = await armClient.GetDefaultSubscriptionAsync();

await foreach (var managedEnvironment in subscription.GetContainerAppManagedEnvironmentsAsync())
{
    await managedEnvironment.AddTagAsync("Sample", "Test");
}

Environment

No response

shibayan avatar Jan 07 '23 09:01 shibayan

Thank you for your feedback. Tagging and routing to the team member best able to assist.

jsquire avatar Jan 07 '23 15:01 jsquire

@fengzhou-msft please help on this issue

ArthurMa1978 avatar Jan 09 '23 06:01 ArthurMa1978

I can reproduce the error. The same exception is thrown although the tag creation actually succeeded. On Portal, the creation of tags in a managed environment also throws a different error ProviderError: Provider 'Microsoft.App' did not return a resource in the response. although the tag creation actually succeeded. Route to service team to check their TagResource support.

fengzhou-msft avatar Jan 18 '23 08:01 fengzhou-msft

Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc @qike-ms, @jwilder, @thomas1206, @seanmck.

Issue Details

Library name and version

Azure.ResourceManager.AppContainers 1.0.1

Describe the bug

Whenever I try to add a resource tag to the Container Apps Managed Environment, it always returns a 409 Conflict error and fails to add it.

Details of the errors returned by the Azure SDK are as follows

Azure.RequestFailedException
  HResult=0x80131500
  Message={"error":{"code":"ManagedEnvironmentOperationInProgress","message":"Cannot modify Container Apps environment cae-acmebot-dev because another operation is in progress."},"code":"ManagedEnvironmentOperationInProgress","message":"Cannot modify Container Apps environment cae-acmebot-dev because another operation is in progress."}
Status: 409 (Conflict)
ErrorCode: ProviderError

Content:
{"error":{"code":"ProviderError","message":"{\"error\":{\"code\":\"ManagedEnvironmentOperationInProgress\",\"message\":\"Cannot modify Container Apps environment cae-acmebot-dev because another operation is in progress.\"},\"code\":\"ManagedEnvironmentOperationInProgress\",\"message\":\"Cannot modify Container Apps environment cae-acmebot-dev because another operation is in progress.\"}"}}

Headers:
Cache-Control: no-cache
Pragma: no-cache
x-ms-failure-cause: REDACTED
x-ms-request-id: 46c24610-2e54-466f-a499-2f1183c511e5
x-ms-correlation-request-id: REDACTED
x-ms-routing-request-id: REDACTED
Strict-Transport-Security: REDACTED
X-Content-Type-Options: REDACTED
Date: Sat, 07 Jan 2023 09:13:18 GMT
Content-Type: application/json; charset=utf-8
Expires: -1
Content-Length: 392

Expected behavior

Resource tags are successfully added.

Actual behavior

Always returns 409 Conflict error and fails to add tags.

Reproduction Steps

var options = new ArmClientOptions
{
    Diagnostics =
    {
        IsLoggingContentEnabled = true,
        IsLoggingEnabled = true
    }
};

var armClient = new ArmClient(new AzureCliCredential(), "<subscription id>", options);

var subscription = await armClient.GetDefaultSubscriptionAsync();

await foreach (var managedEnvironment in subscription.GetContainerAppManagedEnvironmentsAsync())
{
    await managedEnvironment.AddTagAsync("Sample", "Test");
}

Environment

No response

Author: shibayan
Assignees: xboxeer, fengzhou-msft
Labels:

Service Attention, Mgmt, customer-reported, question, needs-team-attention, Container Service

Milestone: -

ghost avatar Jan 18 '23 08:01 ghost

This is caused by the underlying Tag APIs and should have been fixed with Azure.ResourceManager 1.4.0. Please upgrade and retry with below option which fixes the issue of api-version used by SDK not supported by service, probably caused by service recent API update:

options.SetApiVersion(new ResourceType("Microsoft.App/locations/managedEnvironmentOperationStatuses"), "2022-10-01");

fengzhou-msft avatar Feb 20 '23 09:02 fengzhou-msft

Hi, we're sending this friendly reminder because we haven't heard back from you in 7 days. We need more information about this issue to help address it. Please be sure to give us your input. If we don't hear back from you within 14 days of this comment the issue will be automatically closed. Thank you!

ghost avatar Feb 28 '23 02:02 ghost

@fengzhou-msft Thanks for sharing the info. But unfortunately, I modified the code as follows and it returned the same error.

using Azure.Core;
using Azure.Identity;
using Azure.ResourceManager;
using Azure.ResourceManager.AppContainers;

var options = new ArmClientOptions
{
    Diagnostics =
    {
        IsLoggingContentEnabled = true,
        IsLoggingEnabled = true
    }
};

options.SetApiVersion(new ResourceType("Microsoft.App/locations/managedEnvironmentOperationStatuses"), "2022-10-01");

var armClient = new ArmClient(new AzureCliCredential(), "<subscription id>", options);

var subscription = await armClient.GetDefaultSubscriptionAsync();

await foreach (var managedEnvironment in subscription.GetContainerAppManagedEnvironmentsAsync())
{
    await managedEnvironment.AddTagAsync("Sample", "Test");
}

shibayan avatar Feb 28 '23 05:02 shibayan

Hi @shibayan ,Thank you for using Azure SDK for .NET. This issue has been fixe in the latest version of ResourceManager. Please have a try on that.

HarveyLink avatar Aug 11 '23 03:08 HarveyLink