Get in touch with us!


Are you running your azure commands on the right subscription?

I have made a PowerShell function that helps you add or change subscriptions simple and easy. This saves you time if you jump between multiple subscriptions, it also let you see what your current subscription is so that you don’t run your commands in the wrong one.

This is how it works.

First add the module to one of your module paths or import it by using Import-

When you run the function, you will first see your current default subscription and be promoted if this is the one you want to use. From here you can choose Yes to keep the default subscription as is and the only thing the script will do after this is to verify that your session has not expired.

Now you will get a list of all your loaded subscriptions and a dialog that let you choose which one you want to use. There is also an option to add a new account by pressing the “Not in the list”-button.

After you pick one, the script will select it as the current and default subscription and verify that the session is still active.

This way you’ll not accidentally run a script on the wrong subscription.

Jon Jander @MeapaX

Submit a Comment

Your email address will not be published. Required fields are marked *