-
Notifications
You must be signed in to change notification settings - Fork 4k
Enable context autosave by default #6003
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
Conversation
…tions when logging in with default context set
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like some test updates are needed
@@ -97,6 +97,12 @@ static ContextAutosaveSettings InitializeSessionSettings(IDataStore store, strin | |||
result.Mode = settings.Mode; | |||
result.ContextFile = settings.ContextFile ?? result.ContextFile; | |||
} | |||
else | |||
{ | |||
FileUtilities.EnsureDirectoryExists(profileDirectory); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note that we still need to be able to switch back to Process mode if there are any errors in writing these files
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@markcowl updated this so it remains Process
by default but switches to CurrentUser
after we are able to write the settings file
{ | ||
var tempContext = new AzureContext(subscription, account, environment, newTenant); | ||
string tempName = null; | ||
if (!_profile.TryGetContextName(tempContext, out tempName)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this using the name of the subcription? I forgot the logic for this
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@markcowl updated the logic for this after discussion so that the name is now {{subscriptionName}} - {{subscriptionId}}
@@ -227,6 +226,7 @@ public bool TryRemoveContext(IAzureContext context) | |||
} | |||
} | |||
|
|||
bool shouldPopulateContextList = _profile.DefaultContext?.Account == null; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just in case, we should also ensure that _profile?.Contexts?.Count < 2 (actually, this will need to be two null checks, but you get the idea).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@markcowl in this class, _profile
is of the abstracted type IProfileOperations
, which doesn't contain the Contexts
property (the implementation AzureRmProfile
does contain this property, but I doubt we want to use that in this class). Is there a separate check we can do here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
makes sense. As long as we are not overwriting existing contexts, I think we are ok here
Description
Fix for issue #5902
Connect-AzureRmAccount
with the default (empty) context, populate the context list with all subscriptions in the current tenantChecklist
CONTRIBUTING.md
platyPS
module