Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Create Managed Certificate failed with status code 202 #46854

Open
kaibocai opened this issue Oct 27, 2024 · 2 comments
Open

[BUG] Create Managed Certificate failed with status code 202 #46854

kaibocai opened this issue Oct 27, 2024 · 2 comments
Assignees
Labels
App Services customer-reported Issues that are reported by GitHub users external to the Azure organization. Mgmt This issue is related to a management-plane library. needs-team-attention Workflow: This issue needs attention from Azure service team or SDK team question The issue doesn't require a change to the product in order to be resolved. Most issues start as that

Comments

@kaibocai
Copy link
Member

Library name and version

Azure.ResourceManager.AppService 1.2.0

Describe the bug

I use below code to create a managed certificate but I encounter error

2024-10-27T22:23:57Z   [Error]   Failed to create managed cert
2024-10-27T22:23:57Z   [Error]   Service request failed.
Status: 202 (Accepted)

Service request succeeded. Response content and headers are not included to avoid logging sensitive data.
2024-10-27T22:23:57Z   [Error]      at Azure.ResourceManager.AppService.CertificatesRestOperations.CreateOrUpdateAsync(String subscriptionId, String resourceGroupName, String name, AppCertificateData data, CancellationToken cancellationToken)
   at Azure.ResourceManager.AppService.AppCertificateCollection.CreateOrUpdateAsync(WaitUntil waitUntil, String name, AppCertificateData data, CancellationToken cancellationToken)

The code is

            ResourceGroupResource resourceGroupResource =
                this.client.GetDtmbResourceGroupResource(stamp.ManagedSubscriptionId, stamp.ResourceGroupName);
            AppCertificateCollection collection = resourceGroupResource.GetAppCertificates();

            string name = $"{req.DtsEnvName}-cert";
            string hostName = req.DomainName;
            //DomainNameGenerator.GenerateDomainName(req.DtsEnvName, req.Location, this.dnsConfig.DnsZoneName);
            AppCertificateData data = new(new AzureLocation(req.Location))
            {
                // HostNames = { hostName },
                CanonicalName = hostName, 
                ServerFarmId = new ResourceIdentifier(req.AspResourceId),
            };

            ArmOperation<AppCertificateResource> lro =
                await collection.CreateOrUpdateAsync(WaitUntil.Completed, name, data);
            AppCertificateResource result = lro.Value;
            AppCertificateData resourceData = result.Data;

Noticed the error code is 202, I don't really see what this error happen as it's supposed to be a long running/async operation, I am using

            ArmOperation<AppCertificateResource> lro =
                await collection.CreateOrUpdateAsync(WaitUntil.Completed, name, data);

with WaitUntil.Completed set, it should wait till the long running operation finished, but it's not.

Later I checked on the azure portal, I saw that the cert was created successfully. So I don't know why my code gives error, it should await and return succeed.

Expected behavior

The code should work synchronously to create a managed certificate.

Actual behavior

Gives error

2024-10-27T22:23:57Z   [Error]   Failed to create managed cert
2024-10-27T22:23:57Z   [Error]   Service request failed.
Status: 202 (Accepted)

Service request succeeded. Response content and headers are not included to avoid logging sensitive data.
2024-10-27T22:23:57Z   [Error]      at Azure.ResourceManager.AppService.CertificatesRestOperations.CreateOrUpdateAsync(String subscriptionId, String resourceGroupName, String name, AppCertificateData data, CancellationToken cancellationToken)
   at Azure.ResourceManager.AppService.AppCertificateCollection.CreateOrUpdateAsync(WaitUntil waitUntil, String name, AppCertificateData data, CancellationToken cancellationToken)

Reproduction Steps

try out below code

            ResourceGroupResource resourceGroupResource =
                this.client.GetDtmbResourceGroupResource(stamp.ManagedSubscriptionId, stamp.ResourceGroupName);
            AppCertificateCollection collection = resourceGroupResource.GetAppCertificates();

            string name = $"{req.DtsEnvName}-cert";
            string hostName = req.DomainName;
            //DomainNameGenerator.GenerateDomainName(req.DtsEnvName, req.Location, this.dnsConfig.DnsZoneName);
            AppCertificateData data = new(new AzureLocation(req.Location))
            {
                // HostNames = { hostName },
                CanonicalName = hostName, 
                ServerFarmId = new ResourceIdentifier(req.AspResourceId),
            };

            ArmOperation<AppCertificateResource> lro =
                await collection.CreateOrUpdateAsync(WaitUntil.Completed, name, data);
            AppCertificateResource result = lro.Value;
            AppCertificateData resourceData = result.Data;

Environment

.NET SDK:
 Version:           8.0.403
 Commit:            c64aa40a71
 Workload version:  8.0.400-manifests.e99c892e
 MSBuild version:   17.11.9+a69bbaaf5

Runtime Environment:
 OS Name:     Windows
 OS Version:  10.0.22631
 OS Platform: Windows
 RID:         win-x64
 Base Path:   C:\Program Files\dotnet\sdk\8.0.403\

.NET workloads installed:
Configured to use loose manifests when installing new manifests.
 [aspire]
   Installation Source: VS 17.11.35327.3
   Manifest Version:    8.1.0/8.0.100
   Manifest Path:       C:\Program Files\dotnet\sdk-manifests\8.0.100\microsoft.net.sdk.aspire\8.1.0\WorkloadManifest.json
   Install Type:        FileBased


Host:
  Version:      8.0.10
  Architecture: x64
  Commit:       81cabf2857

.NET SDKs installed:
  3.1.426 [C:\Program Files\dotnet\sdk]
  5.0.408 [C:\Program Files\dotnet\sdk]
  6.0.135 [C:\Program Files\dotnet\sdk]
  6.0.321 [C:\Program Files\dotnet\sdk]
  6.0.427 [C:\Program Files\dotnet\sdk]
  7.0.120 [C:\Program Files\dotnet\sdk]
  8.0.306 [C:\Program Files\dotnet\sdk]
  8.0.403 [C:\Program Files\dotnet\sdk]

.NET runtimes installed:
  Microsoft.AspNetCore.App 3.1.32 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 5.0.17 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 6.0.26 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 6.0.35 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 7.0.20 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 8.0.10 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.NETCore.App 3.1.32 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 5.0.17 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 6.0.26 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 6.0.35 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 7.0.20 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 8.0.10 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.WindowsDesktop.App 3.1.32 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
  Microsoft.WindowsDesktop.App 5.0.17 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
  Microsoft.WindowsDesktop.App 6.0.26 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
  Microsoft.WindowsDesktop.App 6.0.35 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
  Microsoft.WindowsDesktop.App 7.0.20 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
  Microsoft.WindowsDesktop.App 8.0.10 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]

Other architectures found:
  x86   [C:\Program Files (x86)\dotnet]
    registered at [HKLM\SOFTWARE\dotnet\Setup\InstalledVersions\x86\InstallLocation]

Environment variables:
  Not set

global.json file:
  Not found

Learn more:
  https://aka.ms/dotnet/info

Download .NET:
  https://aka.ms/dotnet/download
@github-actions github-actions bot added the needs-triage Workflow: This is a new issue that needs to be triaged to the appropriate team. label Oct 27, 2024
@kaibocai
Copy link
Member Author

Can I get some help on this issue, it's blocking our team's development.

@jsquire jsquire added App Services Mgmt This issue is related to a management-plane library. customer-reported Issues that are reported by GitHub users external to the Azure organization. question The issue doesn't require a change to the product in order to be resolved. Most issues start as that needs-team-attention Workflow: This issue needs attention from Azure service team or SDK team and removed needs-triage Workflow: This is a new issue that needs to be triaged to the appropriate team. labels Oct 28, 2024
@jsquire
Copy link
Member

jsquire commented Oct 28, 2024

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
App Services customer-reported Issues that are reported by GitHub users external to the Azure organization. Mgmt This issue is related to a management-plane library. needs-team-attention Workflow: This issue needs attention from Azure service team or SDK team question The issue doesn't require a change to the product in order to be resolved. Most issues start as that
Projects
None yet
Development

No branches or pull requests

4 participants