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

[Collect feedback - important] Settings in cloud for Azure CLI #25675

Open
jsntcy opened this issue Mar 3, 2023 · 6 comments
Open

[Collect feedback - important] Settings in cloud for Azure CLI #25675

jsntcy opened this issue Mar 3, 2023 · 6 comments
Assignees
Labels
Auto-Assign Auto assign by bot Azure CLI Team The command of the issue is owned by Azure CLI team Configure az configure/config Feature Candidate feature-request
Milestone

Comments

@jsntcy
Copy link
Member

jsntcy commented Mar 3, 2023

Why do we need this feature?

Currently the settings for Azure CLI is only in our local machine, the customers may want to share the settings across their machines so they are always working with their favorite settings.

What do we provide?

There will be two new arguments --enable-settings-sync and --disable-settings-sync for az config to allow customers to turn on settings sync or turn off settings sync.

How do we achieve this?

We'll store settings in cloud (centralized storage or customers' own storage) and sync settings across different machines per customer's account.

We’ll be asking you for feedback on this feature. Your participation and feedback are very important to us -- I hope you will take the time to help us improve Azure CLI which a lot of people use every day.

If you like this feature, please help click👍

If you have any suggestions, please help comment under this issue.

Thanks in advance
On behalf of Azure CLI team

@ghost ghost added Auto-Assign Auto assign by bot Configure az configure/config labels Mar 3, 2023
@ghost ghost assigned jiasli Mar 3, 2023
@ghost ghost added this to the Backlog milestone Mar 3, 2023
@jsntcy jsntcy assigned jsntcy and unassigned jiasli Mar 3, 2023
@jsntcy jsntcy pinned this issue Mar 3, 2023
@yonzhan
Copy link
Collaborator

yonzhan commented Mar 3, 2023

roaming profile feature

@yonzhan yonzhan added the Azure CLI Team The command of the issue is owned by Azure CLI team label Mar 3, 2023
@rguptar
Copy link
Contributor

rguptar commented Mar 5, 2023

This would be an awesome feature addition! atuin offers something similar albeit for shell history; it would be interesting to compare.

Not directly related to settings sync, but it would be nice to also have profiles that users can switch between. The commands would look something like this:
az config profile create dev // creates profile named dev
az config profile activate dev // activates profile named dev
az config set cloud <cloud> // sets the default cloud for the active profile
az config set subscription <subscription id> // sets the default subscription for the active profile
az config show // shows the active profile's config
az config profile list // lists all profiles

@jsntcy
Copy link
Member Author

jsntcy commented Mar 6, 2023

@rguptar, thanks for your feedback.
What do you mean for "profiles"?
Is it the same as the profiles in az cloud list-profiles (where the profiles are predefined in Azure CLI)?

@rguptar
Copy link
Contributor

rguptar commented Mar 9, 2023

@jsntcy I'm not familiar with az cloud list-profiles and honestly could not find much with a search. Piecing what I can from this doc, they seem to be per-cloud settings; I could not find a way to create a new profile for a given cloud at least via the cli.

The profiles I am suggesting are user-centric. Let's say a user has four subscriptions, corresponding to personal, dev, and prod azurepublic, prod azureusgovernment. Profiles offer a convenient way to switch between them. Each profile would save the following information (and potentially more):

  • cloud
    az config set cloud <cloud>
  • subscription id
    az config set subscription <subscriptionid>
  • logged in user -> two commands
    az config set account <email address used to login to azure>
    az login

Profiles save the user from entering these 4 commands and potentially going through a login prompt every time they want to switch.

@jsntcy
Copy link
Member Author

jsntcy commented Mar 15, 2023

@jsntcy I'm not familiar with az cloud list-profiles and honestly could not find much with a search. Piecing what I can from this doc, they seem to be per-cloud settings; I could not find a way to create a new profile for a given cloud at least via the cli.

The profiles I am suggesting are user-centric. Let's say a user has four subscriptions, corresponding to personal, dev, and prod azurepublic, prod azureusgovernment. Profiles offer a convenient way to switch between them. Each profile would save the following information (and potentially more):

  • cloud
    az config set cloud <cloud>
  • subscription id
    az config set subscription <subscriptionid>
  • logged in user -> two commands
    az config set account <email address used to login to azure>
    az login

Profiles save the user from entering these 4 commands and potentially going through a login prompt every time they want to switch.

Thanks for explaining and I got your points now.
It's a good suggestion for us to consider.

@jiasli
Copy link
Member

jiasli commented Jun 1, 2023

Other frequently asked questions and feature requests are regarding roaming the default/current subscription.

First, let's answer below questions:

How does Azure CLI determine which subscription to set as the default when the user logs in?

Azure CLI determines which subscription to set as the default following below logic:

  1. List all tenants the user has access by calling Tenants - List REST API
  2. List all subscriptions for all tenants retrieved by previous step by calling Subscriptions - List REST API
  3. Choose the first subscription it receives as the default one:
    def _pick_working_subscription(subscriptions):
    s = next((x for x in subscriptions if x.get(_STATE) == 'Enabled'), None)
    return s or subscriptions[0]

Is that data persisted somewhere that Azure CLI can retrieve?

The default subscription information is only persistent on disk in ~/.azure/azureProfile.json (not ~/.azure/config). Every time az login is run under a refresh login context (you may clear the current context by running az account clear), az login uses the above logic to choose the default subscription.

Feature request: Azure CLI can persist the current subscription information somewhere on the cloud so that users can get this "roaming" experience.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Auto-Assign Auto assign by bot Azure CLI Team The command of the issue is owned by Azure CLI team Configure az configure/config Feature Candidate feature-request
Projects
None yet
Development

No branches or pull requests

4 participants