Quick Summary: if you are seeing the red exclamation on your web apps in the old Azure portal (http://manage.windowsazure.com) run the PowerShell Get-AzureWebsite command to see if you have deployment slots that are orphaned when you deleted the parent Web App. Delete the orphans and the red exclamation (and related issues) will be resolved.
Over the last couple of days I had been dealing with a couple of issues with my Azure Web Apps (formerly known as Azure Web Sites). When I would access the old portal, I would not be able to manage the Web Apps and I would see a visual cue:
The was accompanied by the text: The portal cannot load the management data for this resource type. The new Azure Portal (http://portal.azure.com) did not have any issues accessing the Web Apps. There are a couple occurrences of this documented on stackoverflow.com, but none of those really panned out.
I also had some strange behavior with a couple of other things that I was doing in the portal. I had created a new App Service Plan and migrated all my sites over to it, but I could not delete the old App Service plan through the new portal and the old portal would not let me access the Web Apps or the App Service plans. When I looked at the App Service Plan that I was trying to delete in the new portal it showed as having 0 sites:
You can see from the screen shot that the name of the App Service Plan was “Prod-Sites”. I thought this might have actually been part of the problem. The new portal was updated to prohibit any special character other than the underscore “_” some time after I had created “Prod-Sites”.
The other odd behavior I saw was the inability to add a custom domain to a deployment slot on one of the websites. I was not able to pin down whether that was due to the underlying issue or was just a problem with the new portal (remember that the old portal was not working at the time). Truth be told the deployment slots was what I really should have been working on, the App Service Plan clean up was just some Yak Shaving along the way.
I spent a couple hours over the course of 3 days trying different things in order to resolve the issue(s). At one point I deleted all of the websites on the account, save one that would have been really hard to reconfigure (the other 3 sites deploy from Visual Studio Online with a couple clicks). I was about to delete the last web site when I remembered something my first mentor told me:
“Never trust a GUI when you have the command line” -CJS
I ran the Get-AzureWebsite command in PowerShell and saw the problem:
There were 2 deployment slots listed that belonged to a Web App that I had deleted about a week ago (before all the Yak Shaving started). If you are not familiar with the slots or how they are shown in PowerShell, they are the ones identified with the (test) and (staging) above. The deployment slots are a “feature” of the Web App and are not normally visible in the old or the new portal, unless you open the Web App or look at the settings. It stands to reason that an “orphaned” deployment slot from a Web App would create some havoc with the GUI.
I used the Remove-AzureWebSite PowerShell command with the -Slot option to delete the two slots and that quickly cleared up all of my problems. I don’t know the root cause of the orphaned deployment slots, but as a precaution I will be deleting the Deployment Slots explicitly before I delete the Web App they are associated with to avoid this problem in the future.
I hope this helps…..
Note: A quick tip of the cap goes to Wahid Shalaly who identified this problem a couple weeks before I found it: http://blog.thinkinuous.com/2015/03/problem-solved-orphan-azure-website-deployment-slot.html. I only found his blog post after I solved my problem (and changed the keywords I was searching for).