abij/az-account-switcher

az-switch fails with: Expecting value: line 1 column 1 (char 0)

Closed this issue · 2 comments

az-switch fails because some azure subscriptions are disabled:

$ az-switch 
Expecting value: line 1 column 1 (char 0)
$ az account list --output json

A few accounts are skipped as they don't have 'Enabled' state. Use '--all' to display them.
[
  {
    "cloudName": "AzureCloud",
...

Maybe a simple fix like:

az account list --output json --all

subscriptions = json.loads(subprocess.getoutput('az account list --output json'))

abij commented
abij commented

Fixed with your suggestion and created a new version: https://github.com/abij/az-account-switcher/releases/tag/v0.0.6
pip install -U az-account-switcher solves the issue