In case of a proxy while uploading your VHD to Windows Azure using Powershell

Sometimes when you are trying to do certain process on Windows Azure via Powershell you receive an ambiguous error with no specific error message, make sure that you don’t have a proxy in the environment blocking your communication to Windows Azure, If you do have one, then run the below command and then retry what you were doing before, it should work.

this is basically a .net code that is taking your credentials and passing it on to the proxy while executing your commands.

[System.Net.WebRequest]::DefaultWebProxy.Credentials = [System.Net.CredentialCache]::DefaultCredentials

Windows Azure now allows to set fixed IP-addresses for virtual machines

UP2V

Untill recently IP-addresses of Azure virtual machines were not static/fixed. A VM which had been shutdown (for example to reduce costs, think test/dev scenario’s) could receive a different IP-address at boot than orginally assigned at creation. This leads to all kinds of issues. A new Powershell for Azure version solves this issue.

Introduction
Windows Azure once started as a Platform as a Service (Paas) offer. It is also a best effort cloud, which means the availability should be provided by the application, not by the platform. This is proven for example by the lack of a Service Level Agreement for single instance virtual machines. Customers are required to have at least two virtual machines serving the same application to get a SLA.

Since April 2013 Azure offers Virtual Machines which provides the ability for customers to have full control over the guest operating system. One of the tricky things in…

View original post 366 more words

How to create Highly available (load balanced) FTP Server on Windows Azure?

There are a lot of blog posts that explains how to create a FTP Server on Windows Azure, the best one that I’ve encountered was this one.

http://itq.nl/walkthrough-hosting-ftp-on-iis-7-5-a-windows-azure-vm-2/ by Ronald Wildenberg

So in this post I won’t explain how to create a FTP server on Windows Azure, I’ll explain how to create highly available load balanced FTP Server on Windows Azure.

1st step:

So let’s start by creating two Virtual machines in the same availability set in the same Virtual network and Join them to the same Domain Controller on Azure, check how to add two machines to the same availability set in the below Url.

http://www.windowsazure.com/en-us/manage/windows/common-tasks/manage-vm-availability/

2nd step:

After doing this you attach to each virtual machine an empty disk from Windows Azure, check this Url to know how you can attach an empty disk to Windows Azure VM

http://www.windowsazure.com/en-us/manage/windows/how-to-guides/attach-a-disk/#attachempty

3rd step:

You configure the FTP Service on both of the Virtual Machines using the Ronalds’ blog post above.

4th step:

You install DFS Service on both servers by following the below steps:

1. on the Server Manager , click manage and then click on Add roles and features and wait till the wizard opens and then click next and then choose Role-based or feature-based installation as per the screenshot below

sc1

2. Make sure the highlighted services in RED in the screenshot below are installed on both servers.

sc2

3. Finish the installation of the services on both servers and let’s configure the DFS server in the next step.

4. Open the Server Manager and click on Tools and then click on DFS management, the following wizard will open.

sc3

5. Click on New namespace which allows you to make shared folders located on multiple servers appear as a single tree of folders, follow the wizard below.

sc5

6. choose the name of the server of the first FTP server from the browse wizard and click Next, you will see the next screenshot

sc6

7. Enter the name of the namespace and then choose the permissions that you want to give to the users that will access the folders and then click Next

8. In the Namespace Type , choose the Domain-based namespace and make sure that Enable Windows Server 2008 check box is selected then click Next

9. Confirm your settings and then click create in the wizard, after it finishes, we will click on New Replication Group in the DFS Management

10. choose the Multi purpose Replication group from the wizard as in the screenshot below and then click Next

s4

11. Enter the name of the Replication Group and make sure that the Domain Controller is selected and then click Next

12. Add both servers as Replication Group Members by click on Add button in the below Screenshot and then click Next

s7

12. In the Topology Selection , make sure to Select Full Mesh topology and click Next

13. In the Replicate Group Schedule and bandwidth, choose the right schedule and bandwidth you wish to.

14. Choose each FTP server as the primary in the Primary member step.

15. In the Folders to Replicate step , add the drivers that you attached to each FTP server, each drive on each server

16. In the Local Path of F on other Members , make sure to specify the place where you want to replicate the files from the primary member to the other member.

17. After doing this step, review the setup and then click create , then you are done.

Make sure to replicate same steps on both servers to have completely redundant servers.

Please feel free to get back to me with any questions regarding the implementation or if you faced any errors during the implementation.

How to set your Azure Subscription as default using PowerShell?

After you Import the Publish settings file , to know how to do this, check this post

you first run this command in Windows Azure PowerShell Command:

Select-Azuresubscription

it will prompt for you to enter the name of the subscription, which you can get by running

Get-Azuresubscription

you type in the name of the subscription and then run this command to set your subscription as default.

Set-azuresubscription

it will prompt for you to enter your subscription name again, please enter the same subscription name you entered at the beginning and then you will be able to see the screenshot below which indicates that you have a successful operation.

Image

How to upload files and folders to Windows Azure?

1. First of all make sure that you have done the steps in this blog post.

2. Create a vhd on the disk management on your local computer and copy whatever files you need to upload on windows azure to the vhd after attaching it to your local computer.

3. Open Azure Power Shell Command prompt with elevated permission and make sure your are pointing towards your subscription by running the following command:

get-azuresubscription

it will return your subscription information.

4. Run the following command to upload the vhd to Windows Azure

Add-AzureVhd -Destination <BlobStorageURL>/<YourImagesFolder>/<VHDName> -LocalFilePath <PathToVHDFile>

Replace <BlobStorageURL>/<YourImagesFolder> with the Azure storage account that you want to store the vhd on.

Replace <VHDNAME> with the name you want to display on Windows Azure.

Replace <PathToVHDFile> with the local path of the vhd on your computer.

5. The command will look like this

Add-AzureVhd -Destination “http://blobname.blob.core.windows.net/vhds/azureday.vhd” -LocalFilePath “c:\azureday.vhd”

the command will start calculating and detecting the empty disk blocks , later on it will start the uploading process which will depend on your bandwidth.

The upload process supports the continuation of the failed uploads , you don’t have to start the upload process from the beginning.

6. After the upload process is completed, you will find the vhd under the storage account container you have specified in your vhd-Destination, check the screenshot below.

azurescreenshot

7. Navigate on Windows Azure management portal to Virtual machine pane on the left pane and click on Disks on the right pane, check screenshot below.

Untitled

8. Click on the create button on the lower toolbar, check the screenshot below.

Untitled2

9. Click Ok to create the disk from the VHD.

10. Navigate on Windows Azure management portal to the VM you want to copy the files to and click attach in the lower toolbar,see screenshot.

azurescreenshot2

11. Click on Attach disk and navigate to the storage account/container where you have stored the vhd in step 6.

12. Click Ok to attach the disk to the virtual machine.

13. After the disk is attached successfully, connect to the virtual machine and navigate to the computer management –> Disk management, check attached screenshot.

Untitled3

14. Once you open the disk management, the disk initialization will pop up for you to initialize the disk, continue following the screen instruction to initialize the disk without changing anything.

15. Give the disk drive a letter to be able to access it from the Virtual machine.

Enjoy 🙂

How to establish a connection with your Windows Azure subscription via Power Shell? (Step by Step Guide)

Before you start make sure that you’ve uploaded a self-signed certificate to your Windows Azure subscription, check How in this post

1. You download the Windows Azure Power Shell tool from here 

2. Double click on the downloaded file and it will open the web platform installer 4.5 and the following window will appear.

Image

3. Click install and the following window will appear, make sure that Windows Azure PowerShell is selected and click I accept

Image

4. After this the installation will be completed and the PowerShell will be installed.

5. Open Windows Azure PowerShell Command prompt as an administrator from this location if you are using x64 Processor

C:\windows\SysWOW64\WindowsPowerShell\v1.0\powershell.exe

or here if you are using x86 processor

C:\windows\Sys32\WindowsPowerShell\v1.0\powershell.exe

6.  Type in the PowerShell screen the following command:

set-executionpolicy remotesigned

ps3

7. Then type the following command:

get-azurepublishsettingsfile

This command will open the browser for you to sign in your azure subscription and after you do that , you will have to download the publishsettings file

8. After you save the azure publish settings file on your computer, type the following command in the PowerShell Prompt:

Import-azurepublishsettingsfile “<the file path>”

so if you saved the file on this path “c:\azurepublishfile\yourfilename.publishsettings” then the command will be as the following:

Import-azurepublishsettingsfile “c:\azurepublishfile\yourfilename.publishsettings”

9. To confirm that you can communicate with Azure via PowerShell , type in the following command:

get-azuresubscription

it should return your subscription information.

In the next post, I’ll share some other commands that you can use in PowerShell with Azure.