Microsoft Azure 70-553 - Part 1
This post is just to help me start capturing some of those moments when I got something working in Azure as I studied the syllabus and went "cool"!!
So 15-20% of the score goes to Azure App Service apps, otherwise called WebApps. These are simple web services that you can play with while making up silly website names. One of the first things to play with is deployment slots. I wanted to hack the starting web page so I'd know which of the deployment slots was active as I swapped them in and out to simulate real developer actions as they makes changes / revert changes to a website.
I was having trouble getting WinSCP to FTP to my test WebApp so I dropped to DOS and got it connect there. Steps:
Deploy a WebApp:
Create a few Deployment Slots - I copied the existing WebApp config:
Reset the Deployment Credentials with something you can type in (I'd keep a long cryptic key for Production however):
Log in with the FTP client while in the C:\Temp folder on your local PC:
So I used waws-prod-sn1-013.ftp.azurewebsites.windows.net as the Hostname, alicemushroom\jsoap as the username and the password was one I made up that met the security requirements. Then I was able to navigate to site\wwwroot and download a copy of hostingstart.html.
cd site
cd wwwroot
get hostingstart.html
edit this file in notepad in C:\Temp and make the desired changes
put hostingstart.html
I edited this in Notepad near the bottom, changing the heading to:
Then I was able to use deployment slots to swap it out of Production and back in again. This edited the live Production WebApp. You can edit a Deployment slot directly by using the same URL but changing the username - my first deployment slot uses username: alicemushroom__beta1\jsoap
You need to update each deployment slots credentials but once done you can edit each HTML directly and then swap / revert the Deployment Slots to check each change using the Production URL. AutoSwap is also possible. So when you make a change and save it back to the Deployment FTP it then goes live with it automatically - handier for Developers if you have a BETA and STAGING Deployment Slot - they test in BETA and publish to STAGING to go live.
I went back to WinSCP and got the same settings working allowing me to log in with a GUI interface and have a look around at the WebApp structure.
Simple but fun!!!!
Note: when using your FTP client remember to change the initial directory you are in to site\wwwroot or you will drop the updated html file to the wrong location and scratch your head about why the website isn't updating & AutoSwap isn't working!!! Also try a different browser to avoid cache traps!!
Where would we be without a few PowerShell cmdlets to keep us going?!! I've listed the ones below that mirror some of the objectives done with the Portal above. If you delete the WebApp portal created earlier and recreate it using the same names in PowerShell prepare for some wierd Portal issues. Either clear the cache or switch to a different browser or it will list the new WebApp or sub components thereof as Deleted!!
New-AzureRmResourceGroup -Name alicerg -Location "North Europe"
New-AzureRmAppServicePlan -Name aliceasp -Location "North Europe" -ResourceGroupName alicerg -Tier Standard
New-AzureRmWebApp -ResourceGroupName alicerg -Name alicemushroom -Location "North Europe" -AppServicePlan aliceasp
New-AzureRmWebAppSlot -ResourceGroupName alicerg -Name alicemushroom -Slot staging -AppServicePlan aliceasp
Switch-AzureRmWebAppSlot -ResourceGroupName alicerg -Name alicemushroom -SourceSlotName staging -DestinationSlotName production