Thursday, March 6, 2014

Part-3: Azure and PowerShell: Create a New Website on Windows Azure using PowerShell.

 

Part-1 : Getting Started With Windows Azure And PowerShell

Part-2: Connect To Windows Azure Using PowerShell

 

Hi, in my previous post, I had shown to you how to connect with “Windows Azure” using “PowerShell”.

Now, it’s time to “Do” and create something.

What about creating a website?

Nice idea! Isn’t!

Let’s get started.

In my Azure web portal you can see, currently I have no website.

clip_image002

 

Before open and start working on our “PowerShell” console, let’s have a quick look on what are the options those are required to create a website using Windows Azure web portal.

 

clip_image004

 

You can see in above picture, when we are creating a new website using “Quick Create” option in “Windows Azure” it is asking for provide  “URL” name and select a “Region”.

That’s fine. Let’s do it in our “PowerShell” way.

Open PowerShell console.

First, to get the list of geographical locations, we can use the “Get-AzureLocation” cmdlet. 

 

Run “Get-AzureLocation” cmdlet and pipe the output to “Select-Object” and choose Name property to select.

 

Get-AzureLocation | Select Name

 

Now we know which “Location” name has to use while creating a website. I live in India, to me it seems the “Southeast Asia” is a proper option.

clip_image005

 

Now the next step is to create a website.

For creating a website, use “New-AzureWebsite” cmdlet.

We are creating a website, using location “Southeast Asia’” and with a website name ‘ADhally’. 

New-AzureWebsite -Location ‘Southeast Asia’ -Name ‘ADhally’ 

 

clip_image007

 

When I run the above command, it throw the “EndpoingNotFoundException” error. I was wondering why it is not able to find endpoint.

To solve my curiosity, I checked the geographical locations available while creating website in the Azure web portal. And you can see there are no option of “SouthEast Asia” is listed.

clip_image008 

 

Ohk!

Now for me the closest option to “Southeast Asia” seems to be “East Asia” {because it has Asia word in it !! HA HA !) , let’s try that.

New-AzureWebsite -Location "East Asia" -Name "ADhally" 

 

It work well as expected, without throwing any error.

 

clip_image010

 

In hostname property it has given us the URL link to our newly created website.

Now’ let’s try opening a website which we have just created adhally.azurewebsites.net

 

clip_image012

 

Here you go, website is created successfully.

On our Azure web portal you able to see this newly website too J

 

clip_image014

 

To get the list of all of your website using PowerShell, you can use the “Get-AzureWebsite” cmdlet.

 

clip_image015

 

How to Video

Create a Website on Windows Azure using PowerShell.

 

That’s all for now J  see you in my next blog post.

Regards

Aman

clip_image017 clip_image018 clip_image019 clip_image020  clip_image021

 

No comments:

Post a Comment