jack
jack

Reputation: 43

Error: "Select-AzureSubscription Must specify a non-null subscription name"

I'm receiving the above error when I select the Azure subscription name for an environment in my publish settings file. The below is an example of the code I'm using in PS:

Import-AzurePublishSettingsFile "D:\EnvironmentFile.publishsettings"
Select-AzureSubscription -SubscriptionName "Environment"

The second line is where I get the error; from what I see from examples and MS, this seems to be the correct sequence of events (note that the publish settings file is downloaded from Get-AzurePublishSettingsFile.

Note that I did try to edit each name to make sure they were different, but still got the same error.

Upvotes: 1

Views: 1157

Answers (1)

scott_lotus
scott_lotus

Reputation: 3275

Had a similar issue this morning when attempting to select an azure subscription in Powershell by SubscriptionName.

Resolved following these steps:

Load powershell

Get-AzurePublishSettingsFile

Save the flle to C:\today.publishsettings

Import-AzurePublishSettingsFile C:\today.publishsettings

Take note of the subscription ID required:

Select-AzureSubscription -Id 123456-78911011-1213141516-1718-19201520

Hope that helps someone.

Upvotes: 1

Related Questions