Skip to content

Conversation

@dingmeng-xue
Copy link
Member

Fix for this issue

Azure/azure-powershell#12633

Copy link
Member

@markcowl markcowl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A couple of comments. I assume we also want to fix the default initializer for Connect-AzAccount to be more robust (select the first environment if none is called AzureCloud') and throw a better error message if no environments are available

@@ -0,0 +1,57 @@
[
{
"portal": "https://portal.azure.us",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we might want to add a specific new piece of data with only one enbtry, just for completeness. We want to make sure we protect ourselves from future bugs where we make assumptions about this payload.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure. I will add it.

var armEnvironments = AzureEnvironment.InitializeBuiltInEnvironments(null, httpOperations: TestOperationsFactory.Create().GetHttpOperations());

// Check AzureCloud is added to public environment list even discovery endpoint doesn't return AzureCloud.
Assert.True(AzureEnvironment.PublicEnvironments.ContainsKey(EnvironmentName.AzureCloud));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would assert this for all of the built-in environments

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure. I will add them.

@@ -0,0 +1,57 @@
[
{
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I also got a report on the same thread that there are additional errors that prevent module load when customers use the ARM_CLOUD_METADATA_URL environment variable to point at a metadata endpoint that does not have the 'AzureCloud' entry. I believe we have a test using the environment variable for discovery, and we should ensure that it also convers this scenario.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are right. The discovery approach via default DNS, parameter, or environment variable are going into the same logic. It should be covered.

@dingmeng-xue
Copy link
Member Author

AzureEnvironment.InitializeBuiltInEnvironments is an internal method and public cloud map will be populated after this method. So, in the test case, check public environment variable is not correct because only InitializeBuiltInEnvironments is called. I only check public cloud environment is correctly returned in test cases.

@dingmeng-xue dingmeng-xue merged commit 8a62a28 into Azure:master Aug 14, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants