{"id":78265,"date":"2016-05-26T00:01:46","date_gmt":"2016-05-26T07:01:46","guid":{"rendered":"https:\/\/blogs.technet.microsoft.com\/heyscriptingguy\/?p=78265"},"modified":"2019-02-18T09:10:44","modified_gmt":"2019-02-18T16:10:44","slug":"work-with-the-azure-resource-manager-cmdlets-part-4","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/scripting\/work-with-the-azure-resource-manager-cmdlets-part-4\/","title":{"rendered":"Work with the Azure Resource Manager cmdlets \u2013 Part 4"},"content":{"rendered":"<p><strong>Summary<\/strong>: Learn how to use PowerShell to create storage accounts.<\/p>\n<p>This blog post is part of a series about how to work with the Azure Resource Manager cmdlets. To get the most out of this series, read the posts in order.<\/p>\n<ul>\n<li><a href=\"https:\/\/blogs.technet.microsoft.com\/heyscriptingguy\/2016\/05\/23\/work-with-the-azurerm-cmdlets-part-1\/\">Work with the Azure Resource Manager cmdlets \u2013 Part 1<\/a><\/li>\n<li><a href=\"https:\/\/blogs.technet.microsoft.com\/heyscriptingguy\/2016\/05\/24\/work-with-the-azurerm-cmdlets-part-2\/\">Work with the Azure Resource Manager cmdlets \u2013 Part 2<\/a><\/li>\n<li><a href=\"https:\/\/blogs.technet.microsoft.com\/heyscriptingguy\/2016\/05\/25\/work-with-the-azurerm-cmdlets-part-3\/\">Work with the Azure Resource Manager cmdlets \u2013 Part 3<\/a><\/li>\n<li>Work with the Azure Resource Manager cmdlets \u2013 Part 4<\/li>\n<li><a href=\"https:\/\/blogs.technet.microsoft.com\/heyscriptingguy\/2016\/05\/27\/work-with-the-azure-resource-manager-cmdlets-part-5\/\">Work with the Azure Resource Manager cmdlets \u2013 Part 5<\/a><\/li>\n<\/ul>\n<p>After you finish this series, move on to the next two series to learn more about the Azure Resource Manager cmdlets.<\/p>\n<ul>\n<li><a href=\"https:\/\/blogs.technet.microsoft.com\/heyscriptingguy\/2016\/05\/30\/retrieve-azure-resource-manager-virtual-machine-properties-by-using-powershell-part-1\/\">Retrieve Azure Resource Manager virtual machine properties by using PowerShell<\/a><\/li>\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\" \/>\u00a0Now that we know how to create resource groups, what is our next step to prepare the Azure Resource Manager infrastructure for virtual machines (VMs)?<\/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 today with a wee bit more PowerShell for your Azure Resource Manager world.<\/p>\n<p>If we\u00a0want to ever create our virtual machines, the next step within Azure Resource Manager is to create somewhere to store the VMs and their data. Within Resource Manager, this place is known as a storage account.<\/p>\n<p>As we did yesterday, we\u2019ll show you the <em>slow way<\/em> first (clickity click nightmare) and the <em>express train<\/em> with PowerShell.<\/p>\n<p>Well, remember the old commercial, \u201cFirst you get good, then you get fast\u201d Right? What? What do you mean that commercial was only in Canada?<\/p>\n<p>Ah well, no problem. Let\u2019s get to the serious stuff and learn how to create a storage account.<\/p>\n<p>Naturally, you are already signed in to the Azure portal ahead of time. No? Quickly, then! Sign in, please.<\/p>\n<p>So, as we did yesterday, we click <strong>New<\/strong> and start to type <strong>storage<\/strong> to see a prompted list of options. We then click on the <strong>Storage account<\/strong> option.<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/29\/2019\/02\/1-HSG-052616.png\"><img decoding=\"async\" class=\"alignnone size-full wp-image-78275\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/29\/2019\/02\/1-HSG-052616.png\" alt=\"Screenshot of search for items that include the word, storage.\" width=\"371\" height=\"166\" \/><\/a><\/p>\n<p>For the storage account, you\u2019ll see two options: <strong>Web + Mobile<\/strong> or <strong>VM Extensions<\/strong> . Let\u2019s select <strong>VM Extensions<\/strong> because our target scenario is for VMs.<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/29\/2019\/02\/2-HSG-052616.png\"><img decoding=\"async\" class=\"alignnone size-full wp-image-78285\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/29\/2019\/02\/2-HSG-052616.png\" alt=\"Screenshot that shows the Web + Mobile or VM Extensions options for Storage account.\" width=\"537\" height=\"190\" \/><\/a><\/p>\n<p>After you select <strong>VM Extensions<\/strong>, the first page of the wizard explains what the storage account is (similar to the page from yesterday that explained resource groups).<\/p>\n<p>From this point, click the lovely and magical blue <strong>Create<\/strong> button to get to the fun stuff.<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/29\/2019\/02\/3-HSG-052616.png\"><img decoding=\"async\" class=\"alignnone size-full wp-image-78286\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/29\/2019\/02\/3-HSG-052616.png\" alt=\"Screenshot that shows page that explains the concept of a storage account.\" width=\"424\" height=\"278\" \/><\/a><\/p>\n<p>On our next page, we need to populate some key details:<\/p>\n<ul>\n<li>Name for the storage account (3 to 24 characters in length, <span style=\"text-decoration: underline\">only<\/span> lowercase and numbers)<\/li>\n<li>Deployment model\n<ul>\n<li>Resource Manager (<span style=\"text-decoration: underline\">This one, new<\/span>)<\/li>\n<li>Classic (old Azure VMs)<\/li>\n<\/ul>\n<\/li>\n<li>Account kind\n<ul>\n<li>General purpose<\/li>\n<li>Blob storage<\/li>\n<\/ul>\n<\/li>\n<li>Type of replication for the storage\n<ul>\n<li>Zero-redundant<\/li>\n<li>Locally-redundant<\/li>\n<li>Read-only geo-redundant<\/li>\n<li>Geo-redundant<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<p style=\"padding-left: 90px\">For our demo purposes, we\u2019re going to opt for the Locally-redundant storage. If this were in a temporary machine to be spun up, we could even just use the Zero-redundant option.)<\/p>\n<ul>\n<li>Subscription name<\/li>\n<li>Resource group name\n<ul>\n<li>Remember the one that we created yesterday? We can click the dropdown list and select it or we can have Resource Manager spin up one with a new, relatively random name.<\/li>\n<\/ul>\n<\/li>\n<li>Location\n<ul>\n<li>East US, Canada Central, yadda yadda\u2026.. maybe, eventually, the moon?<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<p>As you can see in the following screenshot, we have selected all the settings that we will need to create a storage account named hsgstorageaccount.core.windows.net in East US.<\/p>\n<p>Click the blue <strong>Create<\/strong> button to kick things into gear.<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/29\/2019\/02\/4-HSG-052616.png\"><img decoding=\"async\" class=\"alignnone size-full wp-image-78295\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/29\/2019\/02\/4-HSG-052616.png\" alt=\"Screenshot that shows information entered to create a storage account.\" width=\"300\" height=\"856\" \/><\/a><\/p>\n<p>As before, we can see a status update from Azure to indicate that things are working as expected.<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/29\/2019\/02\/5-HSG-052616.png\"><img decoding=\"async\" class=\"alignnone size-full wp-image-78305\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/29\/2019\/02\/5-HSG-052616.png\" alt=\"Screenshot that shows progress bar for account creation.\" width=\"441\" height=\"141\" \/><\/a><\/p>\n<p>This process can take a little bit longer because we need to allocate some actual disk space within the Azure Datacenter of your choice. It won\u2019t take <em>hours<\/em>, mind you, but maybe enough time to run up and grab a cup of tea.<\/p>\n<p>Now for the <em>easy<\/em> way to do it with PowerShell. We just need to use the New-AzureRMStorage cmdlet. The information that we need to supply is identical with the exception that the cmdlet will grab your default subscription and just use that. Having said that, if you have multiple subscriptions, you can specify any one of these when you create a storage account.<\/p>\n<p style=\"padding-left: 30px\"><code>$Name=\u2019hsgstorageaccount\u2019\n$Location=\u2019East US\u2019\n$RGName=\u2019HSG-AzureRG\u2019\n$Sku=\u2019Standard_LRS\u2019\n$Storage=\u2019Storage\u2019\nNew-AzureRMStorageAccount \u2013ResourceGroupName $RGName \u2013Name $Name \u2013SkuName $Sku \u2013Location $Location Kind $Storage<\/code><\/p>\n<p>I\u2019ll bet you\u2019re wondering something to yourself. Just <em>how<\/em> did we figure out the name to use for the storage and the SKU to define that information?<\/p>\n<p>One way is to\u00a0use the <strong>Show-Command<\/strong> cmdlet to get a GUI interface to build the output that\u00a0gives you a nice pulldown list.<\/p>\n<p style=\"padding-left: 30px\"><code>Show-Command New-AzureRMStorageAccount<\/code><\/p>\n<p>The other trick? You\u2019ll like this in today\u2019s PowerTip!<\/p>\n<p>Pop in tomorrow when we\u2019ll put together our network settings for a VM.<\/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: Learn how to use PowerShell to create storage accounts. This blog post is part of a series about how to work with the Azure Resource Manager cmdlets. To get the most out of this series, read the posts in order. Work with the Azure Resource Manager cmdlets \u2013 Part 1 Work with the Azure [&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-78265","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: Learn how to use PowerShell to create storage accounts. This blog post is part of a series about how to work with the Azure Resource Manager cmdlets. To get the most out of this series, read the posts in order. Work with the Azure Resource Manager cmdlets \u2013 Part 1 Work with the Azure [&hellip;]<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/posts\/78265","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=78265"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/posts\/78265\/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=78265"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/categories?post=78265"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/tags?post=78265"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}