LinkedIn

Thursday, 31 July 2014

Using Azure Powershell to attach to your azure subscription and create a new website

Hello,

As I haven't posted for a while I wanted to just quickly post my findings on using Azure Powershell.

My aim here using only powershell is to:

  • Connect to my Azure subscription
  • Create a website in azure
  • Stop the website
  • Remove the website

Ok here goes.

Firstly you will need to install Azure Powershell so go here and work it out:

Then fire it up. It should look like this and you can find it in your windows start menu.


then we need to tell powershell about our azure subscription:


We just type Add-AzureAccount and you will be prompted to log into Azure.
Look here for info on this command:

After that you will see some confirmation that it fould your azure account:


You may need to change the execution policy for you to do things from your local Azure:


So here is my Azure website list before I add a new site:


So next I run New-AzureWebsite -Name MyPowerShellTest:


You can see it looks like it did something and returned info about my new site. If you look in Azure you can see the new site:


Nice!

Ok so for fun, lets stop the site:



So it worked.

Now ill delete the website completely using:
Remove-AzureWebsite -Name MyPowerShellTest

And it's gone:


Well, you will have to trust me as I cant show you nothing!

thanks
Russ