{"id":18951,"date":"2015-09-25T15:42:01","date_gmt":"2015-09-25T14:42:01","guid":{"rendered":"https:\/\/aidanfinn.com\/?p=18951"},"modified":"2015-09-25T16:14:09","modified_gmt":"2015-09-25T15:14:09","slug":"how-to-reserve-the-vip-of-an-azure-cloud-service","status":"publish","type":"post","link":"https:\/\/aidanfinn.com\/?p=18951","title":{"rendered":"How to Reserve The VIP Of An Azure Cloud Service"},"content":{"rendered":"<p>Microsoft announced earlier this year that we would have the ability to reserve the public IP address (virtual IP or VIP) of a cloud service in Azure. I\u2019d love that:<\/p>\n<ul>\n<li>VIPs are non-reserved by default, so if your cloud service is suspended (maybe all VMs are shutdown) then you get a different VIP afterwards. That causes mayhem with traditional DNS.<\/li>\n<li>I\u2019ve been using CNAMEs to resolve my domain name to the cloud service\u2019s domain name to abstract the dynamic nature of VIPs. Unfortunately, compliant implementations of CNAME do not support machine names, e.g. <strong><u>www<\/u><\/strong>.aidanfinn.com.<\/li>\n<\/ul>\n<p>What I needed was a reserved VIP. Every now and then I looked for the way to implement this new feature, but I only just found it now.<\/p>\n<p>Fire up Azure PowerShell (make sure it\u2019s up to date) and then log into your subscription using Add-AzureAccount.<\/p>\n<p>Find your service name using Get-AzureService.<\/p>\n<p>Then run the following cmdlet, substituting your choice of label for the VIP, region, and service name:<\/p>\n<pre class=\"lang:default decode:true\">New-AzureReservedIP -ReservedIPName \"MyVIP01\" -Location \"North Europe\" -ServiceName \u201cMyCloudService\u201d<\/pre>\n<p>This cmdlet won\u2019t change the VIP of the cloud service; instead it reserves the existing VIP on your cloud service, which is a non-disruptive action. You can query the results in the GUI or by running Get-AzureReservedIP:<\/p>\n<p><a href=\"https:\/\/aidanfinn.com\/wp-content\/uploads\/2015\/09\/image14.png\"><img loading=\"lazy\" decoding=\"async\" style=\"float: none; margin-left: auto; display: block; margin-right: auto; border: 0px;\" title=\"image\" src=\"https:\/\/aidanfinn.com\/wp-content\/uploads\/2015\/09\/image_thumb13.png\" alt=\"image\" width=\"500\" height=\"240\" border=\"0\" \/><\/a><\/p>\n<p><a href=\"https:\/\/aidanfinn.com\/wp-content\/uploads\/2015\/09\/image15.png\"><img loading=\"lazy\" decoding=\"async\" style=\"float: none; margin-left: auto; display: block; margin-right: auto; border: 0px;\" title=\"image\" src=\"https:\/\/aidanfinn.com\/wp-content\/uploads\/2015\/09\/image_thumb14.png\" alt=\"image\" width=\"500\" height=\"310\" border=\"0\" \/><\/a><\/p>\n<p>To test, I shutdown all the VMs in the cloud service; this puts the cloud service into a suspended state. Normally the VIP is released when a cloud service is suspended. But when I started up the cloud service (starting 1 VM) the same VIP returned. Yay!<\/p>\n<p>Keep in mind that there is a <a href=\"https:\/\/azure.microsoft.com\/en-us\/pricing\/details\/ip-addresses\/\" target=\"_blank\">price plan for reserved VIP addresses<\/a>. You get the first 5 reserved VIPs for free (subject to change). There is a charge for additional VIPs. And if you don\u2019t use a reserved VIP (you reserve it and leave the cloud service suspended) then there\u2019s a charge for the VIP.<\/p>\n<p>Which leads us to the obvious follow-up question: how do I remove a reserved VIP? It\u2019s not quite a logical undo. First you need to undo the association of the VIP reservation with the cloud service. Note that the following is <em>not<\/em> Remove-AzureReservedIP (that cost me 10 minutes):<\/p>\n<pre class=\"lang:default decode:true\">Remove-AzureReservedIPAssociation -ReservedIPName \"MyVIP01\" -ServiceName \u201cMyCloudService\u201d<\/pre>\n<p>Note: I\u2019ve noticed that this cmdlet takes a couple of minutes to run.<\/p>\n<p>If you have the Azure portal open you might see it refresh and change the VIP of your cloud service &#8211; what you\u2019ve done is remove the association of the VIP with that cloud service; the VIP is still reserved.<\/p>\n<p>That opens up an interesting scenario. Let\u2019s say I have an application called App1 running in CloudService1, and I\u2019d like to build a new version of the application in CloudService2 and switch users over without them noticing.<\/p>\n<ol>\n<li>Reserve the VIP on CloudService1<\/li>\n<li>Set up DNS records for App1 to the reserved VIP<\/li>\n<li>Time passes by \u2026 until we want to migrate users \u2026<\/li>\n<li>Remove the VIP association from CloudServcie1; the VIP is still reserved, but now unused<\/li>\n<li>Set the VIP association with CloudService2<\/li>\n<\/ol>\n<p>And all of a sudden, people start using App1 on CloudService2 without changing DNS records \u2026 nice!<\/p>\n<p>When you want to completely remove a VIP reservation, first make sure that you remove any cloud association with Remove-AzureReservedIPAssociation, and then run:<\/p>\n<pre class=\"lang:default decode:true\">Remove-AzureReservedIP -ReservedIPName \"MyVIP01\"<\/pre>\n<div id=\"scid:0767317B-992E-4b12-91E0-4F059A8CECA8:8c98a948-5464-4501-8196-63caa76b43a3\" class=\"wlWriterEditableSmartContent\" style=\"float: none; margin: 0px; display: inline; padding: 0px;\">Technorati Tags: <a href=\"http:\/\/technorati.com\/tags\/Azure\" rel=\"tag\">Azure<\/a>,<a href=\"http:\/\/technorati.com\/tags\/Cloud\" rel=\"tag\">Cloud<\/a>,<a href=\"http:\/\/technorati.com\/tags\/Cloud+Computing\" rel=\"tag\">Cloud Computing<\/a>,<a href=\"http:\/\/technorati.com\/tags\/Networking\" rel=\"tag\">Networking<\/a><\/div>\n","protected":false},"excerpt":{"rendered":"<p>Microsoft announced earlier this year that we would have the ability to reserve the public IP address (virtual IP or VIP) of a cloud service in Azure. I\u2019d love that: VIPs are non-reserved by default, so if your cloud service is suspended (maybe all VMs are shutdown) then you get a different VIP afterwards. That &hellip; <a href=\"https:\/\/aidanfinn.com\/?p=18951\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;How to Reserve The VIP Of An Azure Cloud Service&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":18460,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"om_disable_all_campaigns":false,"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"_uf_show_specific_survey":0,"_uf_disable_surveys":false,"footnotes":""},"categories":[5],"tags":[170,172,59,80],"class_list":["post-18951","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-azure","tag-azure","tag-cloud","tag-cloud-computing","tag-networking"],"aioseo_notices":[],"jetpack_featured_media_url":"https:\/\/aidanfinn.com\/wp-content\/uploads\/2015\/06\/11407095913_bfebcab028_z.jpg","amp_enabled":true,"_links":{"self":[{"href":"https:\/\/aidanfinn.com\/index.php?rest_route=\/wp\/v2\/posts\/18951","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/aidanfinn.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/aidanfinn.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/aidanfinn.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/aidanfinn.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=18951"}],"version-history":[{"count":5,"href":"https:\/\/aidanfinn.com\/index.php?rest_route=\/wp\/v2\/posts\/18951\/revisions"}],"predecessor-version":[{"id":18956,"href":"https:\/\/aidanfinn.com\/index.php?rest_route=\/wp\/v2\/posts\/18951\/revisions\/18956"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/aidanfinn.com\/index.php?rest_route=\/wp\/v2\/media\/18460"}],"wp:attachment":[{"href":"https:\/\/aidanfinn.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=18951"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/aidanfinn.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=18951"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/aidanfinn.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=18951"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}