question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

ApplicationRegion parameter does not work with output from ARM

See original GitHub issue

Describe the bug I have a compute resource in Azure, lets say an AKS cluster. Doesn’t really matter which one since the problem is the same across multiple services:

In my deployment pipeline I run a CLI command to retrieve the region, for instance: az aks show --resource-group my-rg -n mycluster --query "location" --output tsv

This outputs something like northeurope or eastus2. This seems consistent across many Azure resources.

Now, I want to use that output to feed into an app setting which I then want to use to configure my Cosmos DB client with ApplicationRegion:

CosmosClientBuilder clientBuilder = new CosmosClientBuilder(SysConfig.CosmosEndpointUri, SysConfig.CosmosPrimaryKey);
var builderOptions = clientBuilder.WithApplicationRegion(Environment.GetEnvironmentVariable("AZURE_REGION"));

Turns out, you can’t. Because the SDK wants North Europe or East US 2. I don’t see any way how to programmatically split this up

To Reproduce See above.

Expected behavior The SDK should accept standard naming input for Azure regions like northeurope.

Actual behavior See above. image

Environment summary SDK Version: 3.14.0

Issue Analytics

  • State:open
  • Created 2 years ago
  • Reactions:1
  • Comments:21 (19 by maintainers)

github_iconTop GitHub Comments

1reaction
nahk-ivanovcommented, Feb 7, 2023

Should we expect this to be fixed? It is going to be two-year anniversary of this request soon. Does it really take that long to hard code a table or use equality comparer on the existing one that will do .ToLowerInvariant().Replace(" ", "")?

1reaction
sebadercommented, Mar 25, 2021

@ealsur your example is a "regionType": "Logical", I think you can disregard those. Looking at the output I would say only "regionType": "Physical" is important as those are actual regions.

Physical ones seeem to follow the logic, lowercase, no spaces, not special chars

{
    "displayName": "East US 2 EUAP",
    "id": "/subscriptions/0fc3b137-40f9-4c78-a1ae-02bf8065bcd7/locations/eastus2euap",
    "metadata": {
      "geographyGroup": "US",
      "latitude": "36.6681",
      "longitude": "-78.3889",
      "pairedRegion": [
        {
          "id": "/subscriptions/0fc3b137-40f9-4c78-a1ae-02bf8065bcd7/locations/centraluseuap",
          "name": "centraluseuap",
          "subscriptionId": null
        }
      ],
      "physicalLocation": null,
      "regionCategory": "Other",
      "regionType": "Physical"
    },
    "name": "eastus2euap",
    "regionalDisplayName": "(US) East US 2 EUAP",
    "subscriptionId": null
  }
Read more comments on GitHub >

github_iconTop Results From Across the Web

Is there a way to get the output parameters of an ARM ...
I used ResourcesManagementClient.Deployments to deploy my ARM template, the problem is that I do not know how to return my output parameters.
Read more >
Outputs in ARM template - Azure Resource Manager
Describes the functions to use in an Azure Resource Manager template (ARM template) to retrieve deployment information.
Read more >
Quickstart: Troubleshoot ARM template JSON deployments
This quickstart describes how to troubleshoot Azure Resource Manager template (ARM template) JSON deployment errors.
Read more >
ARM template deployment does not work when ...
I'm attempting to deploy an ARM template with a parameters file using the following code IDeployment deploy = azure.Deployments.
Read more >
ARM template deployment does not work when Parameter ...
An unhandled exception of type 'Microsoft.Rest.Azure.CloudException' occurred in mscorlib.dll Additional information: The request content ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found