{"id":78426,"date":"2016-05-30T00:01:32","date_gmt":"2016-05-30T07:01:32","guid":{"rendered":"https:\/\/blogs.technet.microsoft.com\/heyscriptingguy\/?p=78426"},"modified":"2019-02-18T09:10:43","modified_gmt":"2019-02-18T16:10:43","slug":"retrieve-azure-resource-manager-virtual-machine-properties-by-using-powershell-part-1","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/scripting\/retrieve-azure-resource-manager-virtual-machine-properties-by-using-powershell-part-1\/","title":{"rendered":"Retrieve Azure Resource Manager virtual machine properties by using PowerShell \u2013 Part 1"},"content":{"rendered":"<p><strong>Summary<\/strong>: Use the Azure Resource Manager cmdlets to create a virtual machine.<\/p>\n<p>This blog post is part of a series about how to retrieve Azure Resource Manager virtual machine properties by using PowerShell. To get the most out of this series, read the posts in order.<\/p>\n<p>If you\u2019re new to PowerShell, you might want to first read the preceding five-part series about <a href=\"https:\/\/blogs.technet.microsoft.com\/heyscriptingguy\/2016\/05\/23\/work-with-the-azurerm-cmdlets-part-1\/\">how to work with Azure Resource Manager cmdlets<\/a>.<\/p>\n<ul>\n<li>Retrieve Azure Resource Manager virtual machine properties by using PowerShell \u2013 Part 1<\/li>\n<li><a href=\"https:\/\/blogs.technet.microsoft.com\/heyscriptingguy\/2016\/05\/31\/retrieve-azure-resource-manager-virtual-machine-properties-by-using-powershell-part-2\/\">Retrieve Azure Resource Manager virtual machine properties by using PowerShell \u2013 Part 2<\/a><\/li>\n<li><a href=\"https:\/\/blogs.technet.microsoft.com\/heyscriptingguy\/2016\/06\/01\/retrieve-azure-resource-manager-virtual-machine-properties-by-using-powershell-part-3\/\">Retrieve Azure Resource Manager virtual machine properties by using PowerShell \u2013 Part 3<\/a><\/li>\n<li><a href=\"https:\/\/blogs.technet.microsoft.com\/heyscriptingguy\/2016\/06\/02\/retrieve-azure-resource-manager-virtual-machine-properties-by-using-powershell-part-4\/\">Retrieve Azure Resource Manager virtual machine properties by using PowerShell \u2013 Part 4<\/a><\/li>\n<li><a href=\"https:\/\/blogs.technet.microsoft.com\/heyscriptingguy\/2016\/06\/03\/retrieve-azure-resource-manager-virtual-machine-properties-by-using-powershell-part-5\/\">Retrieve Azure Resource Manager virtual machine properties by using PowerShell \u2013 Part 5<\/a><\/li>\n<\/ul>\n<p>After you finish this series, move on to the next series to learn more about the Azure Resource Manager cmdlets.<\/p>\n<ul>\n<li><a href=\"https:\/\/blogs.technet.microsoft.com\/heyscriptingguy\/2016\/06\/06\/create-azure-resource-manager-virtual-machines-by-using-powershell-part-1\/\">Create Azure Resource Manager virtual machines by using PowerShell<\/a><\/li>\n<\/ul>\n<p><img decoding=\"async\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/29\/2019\/02\/q-for-powertip.jpg\" alt=\"Hey, Scripting Guy! Question\" \/>\u00a0I was curious about something. Could you show me a simple example to create a virtual machine (VM) in Azure Resource Manager?<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/29\/2019\/02\/a-for-powertip.jpg\" alt=\"Hey, Scripting Guy! Answer\" \/>\u00a0Honorary Scripting Guy, Sean Kearney, is here to show you one of the <em>coolest<\/em> features of Azure Resource Manager: an easy way to get the information you need to build VMs!<\/p>\n<p>In the old Azure system (the Service Model), you could run cmdlets to get a list of available virtual machine sizes or to access a list of templates. You\u2019d then try to guess which one your machine used.<\/p>\n<p>Let\u2019s show you the <em>easy<\/em> way this week. Do it <em>once<\/em> in the Azure portal, and then have PowerShell ask the machine the questions.<\/p>\n<p>Consider this. If I perform the actions in the GUI and didn\u2019t know JSON, wouldn\u2019t it be great if I could ask the VM the exact size that was used for it? With the new Azure Resource Manager cmdlets, we can!<\/p>\n<p>Let\u2019s first step through the process of creating a VM in Azure by using the new method.<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/29\/2019\/02\/1-HSG-053016.png\"><img decoding=\"async\" class=\"alignnone size-full wp-image-78435\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/29\/2019\/02\/1-HSG-053016.png\" alt=\"Screenshot of the New option in the Azure portal where you create new virtual machines.\" width=\"561\" height=\"204\" \/><\/a><\/p>\n<p>You can now either choose <strong>See all<\/strong> to choose from the massive selection of predefined JSON templates for networks or just a single machine. We\u2019re going to select <strong>Ubuntu Server 14.04 LTS<\/strong> for one big reason.<\/p>\n<p>This is so that you can see that the process to identify and work with properties is <em>identical<\/em> for both Linux and Windows VMs.<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/29\/2019\/02\/2-HSG-053016.png\"><img decoding=\"async\" class=\"alignnone size-full wp-image-78445\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/29\/2019\/02\/2-HSG-053016.png\" alt=\"Screenshot that shows list of predefined JSON templates for networks.\" width=\"319\" height=\"497\" \/><\/a><\/p>\n<p>The next window will be a description of the environment that we are about to spin up. Click the <strong>Create<\/strong> button to continue.<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/29\/2019\/02\/3-HSG-053016.png\"><img decoding=\"async\" class=\"alignnone size-full wp-image-78455\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/29\/2019\/02\/3-HSG-053016.png\" alt=\"Screenshot that shows that you\u2019re creating an Ubuntu Server.\" width=\"544\" height=\"380\" \/><\/a><\/p>\n<p>We now need to populate some details for this VM:<\/p>\n<ul>\n<li>Name for the VM<\/li>\n<li>Default administrator name<\/li>\n<li>Default administrator password<\/li>\n<li>In this scenario, we are using a UserID and password to authenticate, so we will provide a password. It could <em>also<\/em> be a Secure Shell (SSH) public key to connect to the Linux environment.<\/li>\n<li>Our subscription<\/li>\n<li>A resource group (We will use the one, HSG-AzureRG, that we created last week.)<\/li>\n<li>Our location<\/li>\n<\/ul>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/29\/2019\/02\/4-HSG-053016.png\"><img decoding=\"async\" class=\"alignnone size-full wp-image-78465\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/29\/2019\/02\/4-HSG-053016.png\" alt=\"Screenshot that shows completed information for the server that you\u2019re creating.\" width=\"316\" height=\"550\" \/><\/a><\/p>\n<p>The next option is to choose the <em>size<\/em> for the VM. Because I want to keep my subscription under control, I\u2019ll click <strong>View all<\/strong> to try and find the smallest and slowest machine possible. <strong>A0<\/strong> is fine for a slow running demo or for somebody who is trying to not wipe out a budget with one VM.<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/29\/2019\/02\/5-HSG-053016.png\"><img decoding=\"async\" class=\"alignnone size-full wp-image-78475\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/29\/2019\/02\/5-HSG-053016.png\" alt=\"Screenshot that shows options to choose a size for the VM.\" width=\"555\" height=\"368\" \/><\/a><\/p>\n<p>After I select the size of the VM, I can proceed to configure additional features, such as the virtual network that it will exist on and the storage account. You\u2019ll note that we are using the existing virtual network and security group and the storage account that we used last time. Because this is a new VM, we\u2019ll need a public IP in the short term to connect and configure afterwards.<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/29\/2019\/02\/6-HSG-053016.png\"><img decoding=\"async\" class=\"alignnone size-full wp-image-78485\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/29\/2019\/02\/6-HSG-053016.png\" alt=\"Screenshot of configured features for the VM.\" width=\"245\" height=\"632\" \/><\/a><\/p>\n<p>At this point we\u2019ll get a quick summary from Azure Resource Manager that all is okay so that we can click <strong>OK<\/strong> to create the VM.<\/p>\n<p>You\u2019ll now see a summary on the screen while it is deployed.<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/29\/2019\/02\/7-HSG-053016.png\"><img decoding=\"async\" class=\"alignnone size-full wp-image-78495\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/29\/2019\/02\/7-HSG-053016.png\" alt=\"Screenshot that shows that the Ubuntu server is being deployed.\" width=\"243\" height=\"284\" \/><\/a><\/p>\n<p>For now, we\u2019ll sit down and relax. Tomorrow, we\u2019ll start the fun stuff when we show you just where and how to access all the properties from this VM by using PowerShell. Because we can access all these properties from PowerShell, we can use them to create additional VMs easily.<\/p>\n<p>I invite you to follow the Scripting Guys on <a href=\"http:\/\/bit.ly\/scriptingguystwitter\" target=\"_blank\">Twitter<\/a> and <a href=\"http:\/\/bit.ly\/scriptingguysfacebook\" target=\"_blank\">Facebook<\/a>. If you have any questions, send email to them at <a href=\"mailto:scripter@microsoft.com\" target=\"_blank\">scripter@microsoft.com<\/a>, or post your questions on the <a href=\"http:\/\/bit.ly\/scriptingforum\" target=\"_blank\">Official Scripting Guys Forum<\/a>. See you tomorrow.<\/p>\n<p>Until then always remember that with Great PowerShell comes Great Responsibility.<\/p>\n<p><strong>Sean Kearney\n<\/strong>Honorary Scripting Guy\nCloud and Datacenter Management MVP<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Summary: Use the Azure Resource Manager cmdlets to create a virtual machine. This blog post is part of a series about how to retrieve Azure Resource Manager virtual machine properties by using PowerShell. To get the most out of this series, read the posts in order. If you\u2019re new to PowerShell, you might want to [&hellip;]<\/p>\n","protected":false},"author":596,"featured_media":87096,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[568,641],"tags":[56,154,45],"class_list":["post-78426","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-hey-scripting-guy","category-windows-powershell","tag-guest-blogger","tag-sean-kearney","tag-windows-powershell"],"acf":[],"blog_post_summary":"<p>Summary: Use the Azure Resource Manager cmdlets to create a virtual machine. This blog post is part of a series about how to retrieve Azure Resource Manager virtual machine properties by using PowerShell. To get the most out of this series, read the posts in order. If you\u2019re new to PowerShell, you might want to [&hellip;]<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/posts\/78426","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/users\/596"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/comments?post=78426"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/posts\/78426\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/media\/87096"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/media?parent=78426"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/categories?post=78426"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/tags?post=78426"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}