Error: Cannot get Azure subscription ID and thumbprint. Failed in New-FirewallRuleForWebsite in New-AzureSql.ps1

I am working through the eBook "Building Cloud Apps with Microsoft Azure" and when I run New-AzureWebsiteEnv.ps1 I get the following error

Error: Cannot get Azure subscription ID and thumbprint. Failed in New-FirewallRuleForWebsite in New-AzureSql.ps1

I have already tried adding -ExtendedDetails to Get-AzureSubscription in New-AzureSql.ps1 and New-AzureWebsiteEnv.ps1 as suggested in

I am using Azure PowerShell 0.8.16 and Windows 7 Service Pack 1.


This can be fixed by calling Remove-AzureSubscription then re-running Import-AzurePublishSettingsFile

@ScottBrown is right, but for those that don't want to delete their subscription (a bit drastic IMO) here's the steps I followed to get past this annoying issue:

  1. delete the files in C:\Users{your user}\AppData\Roaming\Windows Azure Powershell
  2. restart powershell
  3. login to portal web site
  4. > Get-AzurePublishSettingsFile (look in file to confirm that file has cert data)
  5. > Import-AzurePublishSettingsFile {path to your settings file}/{filename}.publishsettings
  6. run the New-AzureWebsiteEnv.ps1 script...

This blog claims there is an omission in the both the New-AzureWebsiteEnv.ps1 and New-AzureSql.ps1 scripts.

Change $s = Get-AzureSubscription –Current to $s = Get-AzureSubscription -Current –ExtendedDetails

This problem bothered me for half a day but I was finally able to resolve it following these steps.

Note: Before you start, make sure you follow @ScottBrown instructions above and replace all references to Get-AzureSubscription -Current to Get-AzureSubscription -Current -ExtendedDetails in New-AzureSql.ps1 and New-AzureWebsiteEnv.ps1

  1. First, In Azure Powershell, if you use 'Add-Account' this will not work. In fact it might be the primary source of this problem. Start by launching certmrg.msi (Certificates Manager), navigate to Certificates - Current User->Personal->Certificates, then delete all Azure related certificates

  2. Next, you have to remove all imported azure profiles. Navigate to c:\Users[user]\AppData\Roaming\Windows Azure Powershell and delete all files in this folder. Then shut down your powershell console and restart (with administration rights)

  3. Now you can import your Azure profile properly. In Azure Powershell, run> Get-AzurePublishSettingsFile and save the publishsettings file to a specific location

  4. Import your Azure publish settings file using the following command:   Import-AzurePublishSettingsFile–PublishSettingsFile “C:\FolderIRemember\SubScriptionName-date-credentials.publishsettings”. If successful, the console will list the IDs and names of your current subscriptions

  5. Select your default subscription with the following command:Select-AzureSubscription -SubscriptionName "[subscription name]"

  6. Now you can run the following command to make sure your subscription has been properly setup in powershell: Get-AzureSubscription -Current -ExtendedDetails

Take a good look at the result. If the Certificate field is not null (I.e has a subject, Issuer, Serial number, etc) then you are ready to run your script.

If not, then you must have missed a step. Take a look at the comments in the following link for additional guidance:

Need Your Help

jQuery function over ajax

javascript php jquery ajax

I have some jQuery functions defined over some mouse events, for example something like

Detecting redirect in IActionFilter.OnActionExecuted reliably actionfilterattribute

I have an IActionFilter that does something in OnActionExecuted, however I don't want to perform this action when the controller result performs a redirect.