Skip to main content

Utility to switch Azure subscriptions

Project description

Switch Azure subscriptions

Type Badge
Workflow Test !Workflow upload
Latest !PyPI
Activity !PyPI
DeepSource DeepSource

Problem: Switching subscriptions using the Azure CLI involves too much typing.

# Type a lot...
az account list --output table

# Use mouse to select the subscription-id in the console
# Use ctrl-c to copy the text, this might be optional 
 
# Type a lot...
az account set --subscription-id <paste subscription-id>

Solution: I simplified this task with the command-line utility az-switch! The active subscription is bold and green and selected as default argument. Just select the subscription you want to activate.

Install

pip install az-account-switcher

Usage

Usage: az-switch [OPTIONS]

  Show all Azure Subscriptions in current profile using the `az` command-
  line utility. Ask user input for switching to another subscription.

Options:
  -n INTEGER  Switch to this subscription number directly.
  -v          Verbose: echo the azure-cli commands.
  -h, --help  Show this message and exit.

Example

example_gif

CHANGELOG

v1.3.0 (25-02-2022):

  • Speed-up switching by removing the online interaction pulling the Subscriptions through the Azure-CLI. PR-7
  • Removed deprecated get_azure_cli_credentials in PR-6
  • Add --verbose flag as an alias to the -v flag.

v1.2.0 (31-05-2021):

  • Support Windows by changing interaction with Azure-CLI using Python package 'az.cli' instead of POpen
  • Drop Python 3.6 support, due to dependent package 'az.cli'
  • Unit tests running on latest versions of Unix, Windows and MacOs
  • Depend on azure-cli instead of azure-cli-core to auto include packagingto fix issue-3

v1.1.0 (04-05-2021):

  • Don't switch when same subscription is selected.
  • Add -v verbose flag to print Azure-CLI sub-commands.
  • Add -h as alias for --help

Thanks to @tqorange for contributing.

v1.0.0 (08-04-2021):

  • Include Python 3.6, not only greater than.
  • Add DeepSource code checker and resolve found issue (related to shell=true)
  • Add aliases for command-line next to az-switch: + az-account-switch + az-account-switcher (the package name)
  • Dump to v1.0.0, since it's working fine for a while and looks better!

v0.0.6 (25-03-2021):

Add support for disabled subscriptions.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

az-account-switcher-1.3.0.tar.gz (4.8 kB view details)

Uploaded Source

Built Distribution

az_account_switcher-1.3.0-py3-none-any.whl (5.5 kB view details)

Uploaded Python 3

File details

Details for the file az-account-switcher-1.3.0.tar.gz.

File metadata

  • Download URL: az-account-switcher-1.3.0.tar.gz
  • Upload date:
  • Size: 4.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/32.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.62.3 importlib-metadata/4.11.1 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.10.2

File hashes

Hashes for az-account-switcher-1.3.0.tar.gz
Algorithm Hash digest
SHA256 6b669f9dfba02d420e2b711ad30fb72833212713b72ffb4c988762d7c732840b
MD5 aa80820d4f516862294f133550fb65ab
BLAKE2b-256 1cc556d1a91395d9f85e6821ab42bc8f67de3b6564dbd13871a8f131433b76e0

See more details on using hashes here.

File details

Details for the file az_account_switcher-1.3.0-py3-none-any.whl.

File metadata

  • Download URL: az_account_switcher-1.3.0-py3-none-any.whl
  • Upload date:
  • Size: 5.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/32.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.62.3 importlib-metadata/4.11.1 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.10.2

File hashes

Hashes for az_account_switcher-1.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 3d74e3dc1fd12771e1e335fae7e1f38d12a829d1468c5569291a9560ed8b5e0b
MD5 cf2cfa3504e683e07a6275a2fc6e0e54
BLAKE2b-256 d4589fcec553408adf94f041d0f606aba6467205e1b442b95f215fcd8871801f

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page