IMPORTANT ANNOUNCEMENT FOR OUR READERS!
AskPFEPlat is in the process of a transformation to the new Core Infrastructure and Security TechCommunity, and will be moving by the end of March 2019 to our new home at https://aka.ms/CISTechComm (hosted at https://techcommunity.microsoft.com). Please bear with us while we are still under construction!
We will continue bringing you the same great content, from the same great contributors, on our new platform. Until then, you can access our new content on either https://aka.ms/askpfeplat as you do today, or at our new site https://aka.ms/CISTechComm. Please feel free to update your bookmarks accordingly!
Why are we doing this? Simple really; we are looking to expand our team internally in order to provide you even more great content, as well as take on a more proactive role in the future with our readers (more to come on that later)! Since our team encompasses many more roles than Premier Field Engineers these days, we felt it was also time we reflected that initial expansion.
If you have never visited the TechCommunity site, it can be found at https://techcommunity.microsoft.com. On the TechCommunity site, you will find numerous technical communities across many topics, which include discussion areas, along with blog content.
NOTE: In addition to the AskPFEPlat-to-Core Infrastructure and Security transformation, Premier Field Engineers from all technology areas will be working together to expand the TechCommunity site even further, joining together in the technology agnostic Premier Field Engineering TechCommunity (along with Core Infrastructure and Security), which can be found at https://aka.ms/PFETechComm!
As always, thank you for continuing to read the Core Infrastructure and Security (AskPFEPlat) blog, and we look forward to providing you more great content well into the future!
Hello folks, its Rick here. In a previous post Michael gave you nice overview of Windows Azure Services and helped you setup your own VMs in cloud using the free trial thru the Azure portal. Today I would like to walk you through building a VM in Windows Azure using your favorite management tool ‘PowerShell’, and in doing so you will also unlock 133 cmdlets that will help you manage other services you may have running in Windows Azure. If you have not signed up for a 90 day trial yet, I suggest you give it a try. Also did you know if you have an existing MSDN subscription, you may be entitled to up to 1500 compute hours that’s $6500 in annual Windows Azure benefits at no charge.
Let’s get started;
1. Download the Windows Azure PowerShell and install it on a Windows 8, Windows 7, Windows Server 2012, or Windows Server 2008 R2 machine.
2. If you would like to use Windows Azure PowerShell snap-in you can directly launch it from your Start Menu/Screen, but if you are like me and rather import the module into your existing Windows PowerShell, you know the drill.
Import-Module "C:\Program Files (x86)\Microsoft SDKs\Windows Azure\PowerShell\Azure\Azure.psd1"
3. Configuring connectivity between your workstation and Windows Azure; before a connection can be made from your Windows Azure Powershell module you first need to download your publish settings from Azure portal using the cmdlet below.
4. Your browser will take you to https://windows.azure.com/download/publishprofile.aspx, where you can sign in to Windows Azure account download the publish settings file. Note the location where you save this file. This file has Azure API information, your subscription ID and more importantly the management certificate that needs to be imported locally on your machine using another cmdlet.
5. Now we will go ahead the import the publish settings file we have just downloaded using the command below. Where <mysettings>.publishsettings is the file that you downloaded in the previous step. You should delete the publishing profile that you downloaded after you import those settings. The downloaded profile contains a management certificate that should not be accessed by unauthorized users.
You can optionally view the publish settings file you downloaded in Step 4, in Notepad.
6. Let’s take a look at our current subscription, notice the certificate being good for one year since the time you set this up.
7. Now let’s take a look what are some of the cmdlets that Azure PowerShell module unlocks for us, focusing on VM management. You can see the rest here.
8. Let’s see what I already have running out there..
9. We are almost ready to build the VM, but before we do that we have to use Set-AzureSubcription cmdlet to save our subscription information and set the storage account that was previously setup using the Azure portal. You can use the Get-AzureStorageAccount cmdlet to retrieve the StorageAccountName property.
Set-AzureSubscription -SubscriptionName "Windows Azure MSDN – Visual Studio Ultimate" –CurrentStorageAccount portalvhdshmdl42f1wmfd7
You can verify the above command using the Get-AzureSubscription cmdlet again.
Above “portalvhds*” being the name of my storage.
10. Let’s build a new VM using the New-AzureQuickVM cmdlet, (note that as mentioned in the previous post, Azure provides pre built images in VHD, in following example we have run the Get-AzureVMImage and passing the name of a 2012 image. You can also use Test-AzureName cmdlet to verify if the VM or service name you are wanting to acquire is available.
New-AzureQuickVM -Windows -ServiceName TESTADDC03 -Name TESTADDC03 -ImageName MSFT__Windows-Server-2012-Datacenter-201210.01-en.us-30GB.vhd -InstanceSize ‘Small’ -Password Password!@# -AffinityGroup Chicago
You will see everytime you deploy a VM, it first gets created as a Cloud Service and then the VM itself gets deployed, you will see the progress bar for the VM creation as well.
It took less than a minute to spin up this test VM for this demo, your time may vary.
11. Let’s verify that our VM is up and running.
This wraps up this quick tutorial, hopefully you can see that after you have your initial subscription ready and registered and at least one storage account setup, you can provision VMs using PowerShell in a matter of minutes. I invite you try this out yourself and see what other useful cmdlets you find in the Azure PowerShell module.
Until next time, Rick “is there a cmdlet for that” Sheikh !