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

Fix PublicEnvironments initialization when context is autosaved #5727

Closed
gsacavdm opened this issue Mar 12, 2018 · 4 comments
Closed

Fix PublicEnvironments initialization when context is autosaved #5727

gsacavdm opened this issue Mar 12, 2018 · 4 comments

Comments

@gsacavdm
Copy link

gsacavdm commented Mar 12, 2018

Description

Running Enable-AzureRmContextAutosave breaks support for sovereign clouds. After running that command, Get-AzureRmEnvironment returns no results and Login-AzureRmAccount -Environment AzureUSGovernment errors out with "Unable to find environment with name 'AzureUSGovernment'"

Script/Steps for Reproduction

# Show all environments. This works fine if ContextAutoSave is not enabled
Get-AzureRmEnvironment | ft

# Try to log in, this will prompt correctly, cancel out from this dialog
Login-AzureRmAccount -Environment AzureUSGovernment

# Now enable auto save
Enable-AzureRmContextAutosave

# No environments are show anymore
Get-AzureRmEnvironment | ft

# Login fails
Login-AzureRmAccount -Environment AzureUSGovernment

Module Version

5.4.1

Environment Data

Name Value
PSVersion 5.1.16299.248
PSEdition Desktop
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
BuildVersion 10.0.16299.248
CLRVersion 4.0.30319.42000
WSManStackVersion 3.0
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1

contextautosave_fail

@markcowl
Copy link
Member

@gsacavdm Good catch, it looks like environment initialization with built-in environments does not happen until you login once.

Note that you should be able to add the environments, or , if you have an azure login, you can work around this by:

  • logging into Azure
  • closing the session
  • in the new session the get-environment cmdlet should work

@markcowl markcowl changed the title Enable-AzureRmContextAutosave breaks Login for sovereign clouds Fix PublicEnvironments initialization when context is autosaved Mar 14, 2018
@markcowl
Copy link
Member

Fix: Ensure that public environments are properly copied into the context during first execution of the cmdlet

@gsacavdm
Copy link
Author

Workaround worked awesome! Though so that other's that leverage sovereign clouds don't get stuck, it would be ideal to get this fixed. Is this relatively straight forward that you'll be able to address soon? Or maybe provide some guidance so that I can fix it? :)

@cormacpayne
Copy link
Member

This was fixed in version 6.0.1 of AzureRM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants