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

[BUG] AppServicePlanData.IsZoneRedundant returns null values when zone redundancy is enabled

Open EmilDamsbo opened this issue 1 year ago • 9 comments
trafficstars

Library name and version

Azure.ResourceManager.AppService v1.0.2

Describe the bug

AppServicePlan.IsZoneRedundant returns null despite resource in Azure being defined with zone redundancy. My organization has a utility for aggregating various information about our subscriptions, among other being zone redundancy. The code I've written is getting all AppServicePlans from a subscription, and checking the IsZoneRedundant values. However, those values are always null regardless of the value in the Azure Portal. Example of an App Service Plan which is zone redundant: image

Expected behavior

If the Azure Portal reports that the AppServicePlan resource has Zone Redundant enabled, then AppServicePlanData.IsZoneRedundant should return true.

Actual behavior

AppServicePlanData.IsZoneRedundant returns a null value regardless of what Azure Portal reports.

Reproduction Steps

  1. In Azure Portal, create a new Linux app service plan in the Azure portal with a premium SKU and zone redundancy enabled - Deploy it without attaching any apps
  2. Write a small utility to get the data of your Azure subscription, for example like this:
ArmClient armClient = [in my case gotten by managed identity];
var subscription = (await armClient.GetSubscriptions().GetAsync("[subscription id]")).Value;
IEnumerable<AppServicePlanData> plans = subscription.GetAppServicePlans();
foreach (var plan in plans)
{
    // every single plan.Data has IsZoneRedundant == null
}
  1. Set a breakpoint somewhere in the loop and inspect the plans. Here's the entry corresponding to my other screenshot: image

Environment

Test app being run locally as C# .NET 6 in-process Azure Function ( built and run via VS2022 17.8.3 64-bit) Linux-based App Service Plan in Azure Portal.

EmilDamsbo avatar Jan 05 '24 14:01 EmilDamsbo

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

jsquire avatar Jan 05 '24 15:01 jsquire

Just to add some more info: I cloned the SDK repo and added a reference to the AppService project instead of the NuGet, so I could debug what was really going on.

I stepped into the deserialization logic of the app service plan data and there the JSON entries also just had "zoneRedundant": null.

The callstack contains a "Mocking" namespace too, not sure if that is intentional: image

Wondering if this is an issue on the Azure API itself? If so, can you log an internal bug or tell me a support area path I can go to?

EmilDamsbo avatar Jan 05 '24 16:01 EmilDamsbo

Another thing I just thought to try was checking results from an AZ CLI instance using az appservice plan list on my subscription, which does return the correct ZoneRedundant value for my app service plan. Is this merely a question of the managed identity running my function app lacking sufficient privileges in my subscription?

EmilDamsbo avatar Jan 08 '24 12:01 EmilDamsbo

Hi @EmilDamsbo , Thank you for using Azure SDK for .NET. We can't repro this issue on our side, the IsZoneRedundant returns true as we expected. image Both approaches seem working good on out side, code attached

    var plan = (await resourceGroup.GetAppServicePlans().GetAsync("name")).Value;
    Console.WriteLine(plan.Data.IsZoneRedundant);
    var list = resourceGroup.GetAppServicePlans().GetAllAsync();
    await foreach (var item in list)
    {
        Console.WriteLine(item.Data.IsZoneRedundant);
    }

You could use any capture tools to check your actual payload, see if the response value is correct.

HarveyLink avatar Feb 09 '24 02:02 HarveyLink

Hi @EmilDamsbo. 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 Feb 09 '24 02:02 github-actions[bot]

Hi @EmilDamsbo, 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!

github-actions[bot] avatar Feb 16 '24 03:02 github-actions[bot]

@HarveyLink The value is not present in the payload. Could you comment on my previous assertion:

Is this merely a question of the managed identity running my function app lacking sufficient privileges in my subscription?

If that could be the case, could you guide me towards which access my MI is lacking?

EmilDamsbo avatar Feb 19 '24 14:02 EmilDamsbo

@HarveyLink The value is not present in the payload. Could you comment on my previous assertion:

Is this merely a question of the managed identity running my function app lacking sufficient privileges in my subscription?

If that could be the case, could you guide me towards which access my MI is lacking?

Hi, We don't have much domain knowledge on a single service. If there is a sufficient privileges lacking here, you may need to open an Azure support request

HarveyLink avatar Feb 20 '24 02:02 HarveyLink

Hi @EmilDamsbo. 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 Feb 21 '24 07:02 github-actions[bot]

Hi @EmilDamsbo, 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!

github-actions[bot] avatar Feb 28 '24 09:02 github-actions[bot]

If anyone runs into this in the future: Use GetAppServicePlans(detailed: true), Zone redundancy property is apparently not returned by default.

EmilDamsbo avatar Apr 30 '24 09:04 EmilDamsbo