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

[BUG] `CustomDomainConfiguration.ExpireOn` in `ContainerAppManagedEnvironmentData` always returns null

Open shibayan opened this issue 2 years ago • 6 comments

Library name and version

Azure.ResourceManager.AppContainers 1.0.1

Describe the bug

The CustomDomainConfiguration.ExpireOn property adds a custom DNS suffix setting and always returns null even if a valid certificate is uploaded.

At the REST API level, the correct values seem to have been returned, but the property names were different. expirationDate => expirationDateUtc

Expected behavior

If a certificate has been uploaded, the expiration date of the certificate is returned.

Actual behavior

A null value is always returned even if a certificate has been uploaded.

Reproduction Steps

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

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

var subscription = await armClient.GetDefaultSubscriptionAsync();

await foreach (var managedEnvironment in subscription.GetContainerAppManagedEnvironmentsAsync())
{
    Console.WriteLine(managedEnvironment.Data.Name);

    // always return null
    Console.WriteLine(managedEnvironment.Data.CustomDomainConfiguration.ExpireOn);
}

Environment

No response

shibayan avatar Jan 05 '23 08:01 shibayan

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

jsquire avatar Jan 05 '23 13:01 jsquire

@shibayan can you try print the log information so that we can see if the raw json response includes the ExpireOn information

xboxeer avatar Jan 06 '23 08:01 xboxeer

@xboxeer Of course. The response is captured below.

[Informational] Azure-Core: Response [ef27a954-ba4d-4892-b6f8-9cc79f4d7c4e] 200 OK (01.2s)
Cache-Control:no-cache
Pragma:no-cache
x-ms-original-request-ids:REDACTED
x-ms-ratelimit-remaining-subscription-reads:REDACTED
x-ms-request-id:b9b9ffe7-b9b0-4515-8958-92258e91864e
x-ms-correlation-request-id:REDACTED
x-ms-routing-request-id:REDACTED
Strict-Transport-Security:REDACTED
X-Content-Type-Options:REDACTED
Date:Fri, 06 Jan 2023 08:12:38 GMT
Content-Type:application/json; charset=utf-8
Expires:-1
Content-Length:2102

[Verbose] Azure-Core: Response [ef27a954-ba4d-4892-b6f8-9cc79f4d7c4e] content: {"value":[{"id":"/subscriptions/082a97c2-8b37-4114-a3c9-8df8b4a2c15e/resourceGroups/rg-container-app/providers/Microsoft.App/managedEnvironments/cae-acmebot-dev","name":"cae-acmebot-dev","type":"Microsoft.App/managedEnvironments","location":"eastus2","systemData":{"createdBy":"[email protected]","createdByType":"User","createdAt":"2022-05-13T04:37:53.9608989","lastModifiedBy":"b21bcb93-2f0a-447c-a77a-8fa96ba6e605","lastModifiedByType":"Application","lastModifiedAt":"2023-01-05T07:46:30.4581959"},"properties":{"provisioningState":"Succeeded","defaultDomain":"ambitiousmoss-a1bc5ad6.eastus2.azurecontainerapps.io","staticIp":"20.96.148.98","appLogsConfiguration":{"destination":"log-analytics","logAnalyticsConfiguration":{"customerId":"86e00727-da65-4158-a1be-b87558fcb5f0"}},"zoneRedundant":false,"customDomainConfiguration":{"customDomainVerificationId":"B5E66C32A5ABDC3F4F363FBE87839D7E4B931EE88E166D32E3BF188B0263653D","dnsSuffix":"suffix.hackazure.net","thumbprint":"1D429D5B6F61579802062D1534E96AE12D1CD9DE","subjectName":"CN=*.suffix.hackazure.net","expirationDateUtc":"2023-04-05T06:46:26"}},"sku":{"name":"Consumption"}}]}

shibayan avatar Jan 06 '23 08:01 shibayan

According to service swagger spec, they should return expirationDate instead of expireationDateUtc Swagger spec: https://github.com/Azure/azure-rest-api-specs/blob/main/specification/app/resource-manager/Microsoft.App/stable/2022-10-01/CommonDefinitions.json#L324

SDK source code based on swagger spec: https://github.com/Azure/azure-sdk-for-net/blob/03b18a5e8b769da5ab03b26f86cb97dab96359a0/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Models/ContainerAppCustomDomainConfiguration.Serialization.cs#L73

You can use the policy to change the response payload by replacing expireationDateUtc with expirationDate . SDK team will check with container apps team about why they return expireationDateUtc

xboxeer avatar Jan 06 '23 08:01 xboxeer

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

The CustomDomainConfiguration.ExpireOn property adds a custom DNS suffix setting and always returns null even if a valid certificate is uploaded.

At the REST API level, the correct values seem to have been returned, but the property names were different. expirationDate => expirationDateUtc

Expected behavior

If a certificate has been uploaded, the expiration date of the certificate is returned.

Actual behavior

A null value is always returned even if a certificate has been uploaded.

Reproduction Steps

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

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

var subscription = await armClient.GetDefaultSubscriptionAsync();

await foreach (var managedEnvironment in subscription.GetContainerAppManagedEnvironmentsAsync())
{
    Console.WriteLine(managedEnvironment.Data.Name);

    // always return null
    Console.WriteLine(managedEnvironment.Data.CustomDomainConfiguration.ExpireOn);
}

Environment

No response

Author: shibayan
Assignees: xboxeer
Labels:

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

Milestone: -

ghost avatar Jan 06 '23 08:01 ghost

@shibayan Thanks for reaching out to us and reporting this issue. I wanted to check if you observe the same issue with the old Azure.Management.Fluent( deprecated) SDK too ?

using System;
using Microsoft.Azure.Management.AppService.Fluent;
using Microsoft.Azure.Management.Fluent;
using Microsoft.Azure.Management.ResourceManager.Fluent.Authentication;
using Microsoft.Azure.Management.ResourceManager.Fluent.Core;
using Azure.ResourceManager.AppContainers;
using Azure.ResourceManager.AppContainers.Models;

namespace AzureSampleCode
{
    class Program
    {
        static void Main(string[] args)
        {
            // Replace these values with your own subscription ID, client ID, client secret, and tenant ID
            string subscriptionId = "your-subscription-id";
            string clientId = "your-client-id";
            string clientSecret = "your-client-secret";
            string tenantId = "your-tenant-id";

            // Create an Azure credential using the service principal
            var credentials = SdkContext.AzureCredentialsFactory.FromServicePrincipal(clientId, clientSecret, tenantId, AzureEnvironment.AzureGlobalCloud);

            // Create an Azure management client
            var azure = Azure
                .Configure()
                .WithLogLevel(HttpLoggingDelegatingHandler.Level.Basic)
                .Authenticate(credentials)
                .WithSubscription(subscriptionId);

            // Get the resource group for the container app managed environment
            string resourceGroupName = "your-resource-group-name";
            var resourceGroup = azure.ResourceGroups.GetByName(resourceGroupName);

            // Get the container app managed environment
            string appManagedEnvironmentName = "your-app-managed-environment-name";
            var appManagedEnvironment = resourceGroup.ContainerAppManagedEnvironments.GetByName(appManagedEnvironmentName);

            // Get the resource ID of the container app managed environment
            string appManagedEnvironmentResourceId = appManagedEnvironment.Id;

            // Create a client for the container app managed environment
            var appContainersClient = new AppContainersClient(credentials);
            appContainersClient.SubscriptionId = subscriptionId;

            // Get the custom domain details for the container app managed environment
            var customDomain = appContainersClient.AppManagedEnvironments.GetCustomDomain(resourceGroupName, appManagedEnvironmentName);
            Console.WriteLine("Custom domain name: " + customDomain.Name);
            Console.WriteLine("Custom domain certificate: " + customDomain.SslState);
        }
    }
}

navba-MSFT avatar Jan 09 '23 04:01 navba-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 Jan 19 '23 08:01 ghost

@navba-MSFT I am trying to get the sample code you shared to work, but I could not get it to build properly. This does not appear to be a problem with the new SDK, but rather a difference between the OpenAPI definition and the actual API behavior.

shibayan avatar Jan 19 '23 16:01 shibayan

Synced with @Juliehzl from the service team, expireationDateUtc has been removed on the server side now and they will add expirationDate back to align with the swagger definition.

live1206 avatar May 26 '23 09:05 live1206

@shibayan The service response has been fixed, could you verify this works? Thanks!

live1206 avatar Jun 28 '23 07:06 live1206

Hi @shibayan. Thank you for opening this issue and giving us the opportunity to assist. To help our team better understand your issue and the details of your scenario please provide a response to the question asked above or the information requested above. This will help us more accurately address your issue.

github-actions[bot] avatar Jun 28 '23 07:06 github-actions[bot]

@live1206 I have confirmed that this has been fixed in 1.0.3. Thanks!

shibayan avatar Jul 02 '23 04:07 shibayan