{"id":500,"date":"2019-12-10T04:27:51","date_gmt":"2019-12-10T04:27:51","guid":{"rendered":"http:\/\/draith.azurewebsites.net\/?p=500"},"modified":"2019-12-10T04:27:51","modified_gmt":"2019-12-10T04:27:51","slug":"disaster-leads-to-azure","status":"publish","type":"post","link":"https:\/\/draith.com\/?p=500","title":{"rendered":"Disaster leads to Azure"},"content":{"rendered":"\n<h2 class=\"wp-block-heading\">How a sinister act leads to great things &#8211; in about 15 minutes<\/h2>\n\n\n\n<p><\/p>\n\n\n\n<p>This Sunday, as the wife and I traveled back from Dallas to Austin after a weekend away I get a text from an automated website monitor.  My WordPress blog &#8211; this blog &#8211; was either offline or not responding correctly.  Happens occasionally.    When I got home I popped up the site, and immediately got a message about php being a really old version &#8211; like 5.x &#8211; when it normally runs a 7.x version.  I decided to log into my provider and check it out.  I was not prepared with what I saw.<\/p>\n\n\n\n<p>It was obvious that I had been hacked, big time.  Redirects to shady pharma sites in Russia, CSS injection on <strong>every <\/strong>post, random hacked php files in practically every directory in not just this domain but in 8 sub-domains as well.  I was well and truly up the creek.  To make it even better, the hosting service I use seems to think that UI enhancements are forbidden &#8211; hence my inability to download a current backup.  <\/p>\n\n\n\n<p>I had to do something, and quick.  This blog contains some of my contributions to the community, and does (shockingly) show up in search results.  I needed to get it back up and running quick.  The only thing I had was an XML export from the blog a couple of weeks back.  I immediately decided to use Azure to get this running quick.  <\/p>\n\n\n\n<p>For those who don&#8217;t know, the easiest way to export from a WordPress blog is to go to Tools &#8211; Export &#8211; All content.  I suggest you do it often.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"627\" height=\"705\" src=\"\/wp-content\/uploads\/2019\/12\/image.png\" alt=\"\" class=\"wp-image-501\" srcset=\"\/wp-content\/uploads\/2019\/12\/image.png 627w, \/wp-content\/uploads\/2019\/12\/image-267x300.png 267w\" sizes=\"auto, (max-width: 709px) 85vw, (max-width: 909px) 67vw, (max-width: 984px) 61vw, (max-width: 1362px) 45vw, 600px\" \/><\/figure>\n\n\n\n<p>I jumped over to Azure, and provisioned a new resource.  Since this was going to be an actual production thing, and not just some testing resource for a conference or for a post, I decided to use a new resource group.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"884\" height=\"337\" src=\"\/wp-content\/uploads\/2019\/12\/image-1.png\" alt=\"\" class=\"wp-image-502\" srcset=\"\/wp-content\/uploads\/2019\/12\/image-1.png 884w, \/wp-content\/uploads\/2019\/12\/image-1-300x114.png 300w, \/wp-content\/uploads\/2019\/12\/image-1-768x293.png 768w\" sizes=\"auto, (max-width: 709px) 85vw, (max-width: 909px) 67vw, (max-width: 1362px) 62vw, 840px\" \/><\/figure>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"461\" height=\"930\" src=\"\/wp-content\/uploads\/2019\/12\/image-2.png\" alt=\"\" class=\"wp-image-503\" srcset=\"\/wp-content\/uploads\/2019\/12\/image-2.png 461w, \/wp-content\/uploads\/2019\/12\/image-2-149x300.png 149w\" sizes=\"auto, (max-width: 461px) 85vw, 461px\" \/><\/figure>\n\n\n\n<p><\/p>\n\n\n\n<p>Note &#8211; I choose to do a MySQL database in the app &#8211; mainly because I needed this up and running quickly, and I don&#8217;t have traffic substantial enough to warrant scaling backend MySQL instances.   For large instances, I would recommend using &#8216;Azure Database for MySQL&#8217; &#8211; that allows options like scaling, larger instances, etc&#8230;<\/p>\n\n\n\n<p>The deployment of the WordPress instance was honestly the longest part of the process &#8211; it took between 7 &#8211; 10 minutes, but once it was up and running you are presented with a brand new WordPress instance:<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"351\" src=\"\/wp-content\/uploads\/2019\/12\/image-3-1024x351.png\" alt=\"\" class=\"wp-image-504\" srcset=\"\/wp-content\/uploads\/2019\/12\/image-3-1024x351.png 1024w, \/wp-content\/uploads\/2019\/12\/image-3-300x103.png 300w, \/wp-content\/uploads\/2019\/12\/image-3-768x264.png 768w, \/wp-content\/uploads\/2019\/12\/image-3-1536x527.png 1536w, \/wp-content\/uploads\/2019\/12\/image-3-1200x412.png 1200w, \/wp-content\/uploads\/2019\/12\/image-3.png 1719w\" sizes=\"auto, (max-width: 709px) 85vw, (max-width: 909px) 67vw, (max-width: 1362px) 62vw, 840px\" \/><\/figure>\n\n\n\n<p>Click on the URL, and you are presented with the interface for your brand new WordPress instance.  Now we continue with the WordPress setup<\/p>\n\n\n\n<p><\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"981\" src=\"\/wp-content\/uploads\/2019\/12\/image-4-1024x981.png\" alt=\"\" class=\"wp-image-505\" srcset=\"\/wp-content\/uploads\/2019\/12\/image-4-1024x981.png 1024w, \/wp-content\/uploads\/2019\/12\/image-4-300x288.png 300w, \/wp-content\/uploads\/2019\/12\/image-4-768x736.png 768w, \/wp-content\/uploads\/2019\/12\/image-4.png 1156w\" sizes=\"auto, (max-width: 709px) 85vw, (max-width: 909px) 67vw, (max-width: 1362px) 62vw, 840px\" \/><\/figure>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"959\" src=\"\/wp-content\/uploads\/2019\/12\/image-5-1024x959.png\" alt=\"\" class=\"wp-image-506\" srcset=\"\/wp-content\/uploads\/2019\/12\/image-5-1024x959.png 1024w, \/wp-content\/uploads\/2019\/12\/image-5-300x281.png 300w, \/wp-content\/uploads\/2019\/12\/image-5-768x719.png 768w, \/wp-content\/uploads\/2019\/12\/image-5.png 1074w\" sizes=\"auto, (max-width: 709px) 85vw, (max-width: 909px) 67vw, (max-width: 1362px) 62vw, 840px\" \/><\/figure>\n\n\n\n<p><\/p>\n\n\n\n<p>Now update your WordPress &#8211; immediately.  After updating, log out and back in, just in case the WordPress database needs to update as well.  Once everything is updated, it&#8217;s time to import the WordPress XML.<\/p>\n\n\n\n<p><\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"634\" height=\"755\" src=\"\/wp-content\/uploads\/2019\/12\/image-6.png\" alt=\"\" class=\"wp-image-507\" srcset=\"\/wp-content\/uploads\/2019\/12\/image-6.png 634w, \/wp-content\/uploads\/2019\/12\/image-6-252x300.png 252w\" sizes=\"auto, (max-width: 709px) 85vw, (max-width: 909px) 67vw, (max-width: 984px) 61vw, (max-width: 1362px) 45vw, 600px\" \/><\/figure>\n\n\n\n<p>  When you install the importer, then the &#8216;Run Importer&#8217; option will appear.  Upload your XML file and let the importer run.  In my case it took about 5 minutes.  A great thing about this import &#8211; it takes all of your settings &#8211; preferences, link post IDs, media, etc&#8230;  This was in many ways much better than doing a restore on my normal hosting provider &#8211; I have my blog back up and running (minus some theme customization), but I have the entire power of Azure behind it!  I get Azure Monitor &#8211; Azure Sentinel, App Insights, Log Analytics, and more!<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"875\" height=\"1024\" src=\"\/wp-content\/uploads\/2019\/12\/image-7-875x1024.png\" alt=\"\" class=\"wp-image-509\" srcset=\"\/wp-content\/uploads\/2019\/12\/image-7-875x1024.png 875w, \/wp-content\/uploads\/2019\/12\/image-7-256x300.png 256w, \/wp-content\/uploads\/2019\/12\/image-7-768x899.png 768w, \/wp-content\/uploads\/2019\/12\/image-7.png 1165w\" sizes=\"auto, (max-width: 709px) 85vw, (max-width: 909px) 67vw, (max-width: 1362px) 62vw, 840px\" \/><\/figure>\n\n\n\n<p>Next, it was time to redirect my old-and-busted blog to the new blog website.  This is going to differ by hosting provider, but in my case it was fairly simple. <\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"598\" height=\"316\" src=\"\/wp-content\/uploads\/2019\/12\/image-8.png\" alt=\"\" class=\"wp-image-510\" srcset=\"\/wp-content\/uploads\/2019\/12\/image-8.png 598w, \/wp-content\/uploads\/2019\/12\/image-8-300x159.png 300w\" sizes=\"auto, (max-width: 598px) 85vw, 598px\" \/><\/figure>\n\n\n\n<p>What are the next steps?  In my case, it is going to be adding a custom domain to my App service, so that I no longer have to rely on my old hosting provider, and use them solely as domain registrar.  That will be in an upcoming post.<\/p>\n\n\n\n<p>In my case, something as horrible as a hack has led to a great outcome &#8211; hosting in Azure, really cheaply, with an absolute glut of new features at my disposal.  This hack might have been the best thing to happen to this blog in a while.  Who knows &#8211; maybe I will just continue to add new Azure features and see how it turns out.<\/p>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>How a sinister act leads to great things &#8211; in about 15 minutes This Sunday, as the wife and I traveled back from Dallas to Austin after a weekend away I get a text from an automated website monitor. My WordPress blog &#8211; this blog &#8211; was either offline or not responding correctly. Happens occasionally. &hellip; <a href=\"https:\/\/draith.com\/?p=500\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Disaster leads to Azure&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[4],"class_list":["post-500","post","type-post","status-publish","format-standard","hentry","category-uncategorized","tag-azure"],"_links":{"self":[{"href":"https:\/\/draith.com\/index.php?rest_route=\/wp\/v2\/posts\/500","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/draith.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/draith.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/draith.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/draith.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=500"}],"version-history":[{"count":3,"href":"https:\/\/draith.com\/index.php?rest_route=\/wp\/v2\/posts\/500\/revisions"}],"predecessor-version":[{"id":512,"href":"https:\/\/draith.com\/index.php?rest_route=\/wp\/v2\/posts\/500\/revisions\/512"}],"wp:attachment":[{"href":"https:\/\/draith.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=500"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/draith.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=500"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/draith.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=500"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}