Home
%3CLINGO-SUB%20id%3D%22lingo-sub-734965%22%20slang%3D%22en-US%22%3EAzure%20Cloud%20Shell%20Tips%20for%20SysAdmins%3A%20Part%20II%20-%20Using%20the%20Cloud%20Shell%20tools%20to%20Migrate%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-734965%22%20slang%3D%22en-US%22%3E%3CP%3EAs%20an%20Azure%20Advocate%2C%20one%20of%20the%20things%20I%20spend%20my%20time%20doing%20is%20learning%20the%20easiest%20ways%20for%20beginners%20to%20use%20Microsoft%20Azure.%20Today%20I%20want%20to%20share%20with%20you%20a%20few%20ways%20to%20utilize%20some%20tools%20that%20are%20built%20right%20into%20Azure.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EIn%20my%20last%20blog%20post%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2FITOps-Talk-Blog%2FAzure-Cloud-Shell-Tips-for-SysAdmins-Part-I-Bash-and-tools-for%2Fba-p%2F734958%22%20target%3D%22_blank%22%20rel%3D%22noopener%22%3EAzure%20Cloud%20Shell%20Tips%20for%20SysAdmins%20(bash)%3C%2FA%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3EI%20discussed%20some%20of%20the%20tools%20that%20the%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fazure%2Fcloud-shell%2Fquickstart%3FWT.mc_id%3DITOPSTALK-blog-jagord%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noopener%20noreferrer%20noopener%20noreferrer%22%3EAzure%20Cloud%20Shell%20for%20bash%3C%2FA%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Ealready%20has%20built%20into%20it.%26nbsp%3B%20This%20time%20I%20will%20go%20a%20bit%20deeper%20and%20show%20you%20how%20to%20utilize%20a%20combination%20of%20the%20tools%20to%20create%20an%20UbuntuLTS%20Linux%20server.%26nbsp%3B%20Once%20the%20server%20is%20provisioned%2C%20I%20will%20demonstrate%20how%20to%20use%20Ansible%20to%20deploy%20Node.js%20from%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CA%20href%3D%22https%3A%2F%2Fgithub.com%2Fnodesource%2Fdistributions%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noopener%20noreferrer%20noopener%20noreferrer%22%3Ethe%20nodesource%20binary%20repository.%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3ERequirements%20for%20tutorial%3A%3C%2FP%3E%0A%3CUL%3E%0A%3CLI%3EAzure%20Account%3C%2FLI%3E%0A%3CLI%3EAzure%20Cloud%20Shell%20(bash)%3C%2FLI%3E%0A%3CLI%3ESome%20SSH%20and%20text%20editing%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3CH3%20id%3D%22toc-hId-1594997075%22%20id%3D%22toc-hId-1594997075%22%3E%3CA%20class%3D%22anchor%22%20href%3D%22https%3A%2F%2Fdev.to%2Fazure%2Fazure-cloud-shell-tips-for-sysadmins-part-ii-using-the-cloud-shell-tools-to-migrate-3ka8%23whats-the-point-of-all-this%22%20target%3D%22_blank%22%20rel%3D%22noopener%20nofollow%20noopener%20noreferrer%20noopener%20noreferrer%22%20name%3D%22whats-the-point-of-all-this%22%3E%3C%2FA%3EWhat%E2%80%99s%20the%20point%20of%20all%20this%3F%3C%2FH3%3E%0A%3CP%3EGood%20question.%26nbsp%3B%20From%20my%20travels%20as%20a%20Cloud%20Advocate%2C%20I%20really%20have%20noticed%20that%20many%20users%20who%E2%80%99ve%20come%20from%20the%20world%20of%20System%20Administration%20need%20the%20tools%20and%20tutorials%20to%20walk%20before%20they%20can%20run.%26nbsp%3B%20It%E2%80%99s%20great%20to%20use%20Kubernetes%20to%20orchestrate%20a%20complex%20distributed%20system.%20But%20if%20that%E2%80%99s%20not%20quite%20where%20you%20are%20in%20the%20steps%20of%20moving%20to%20the%20cloud%2C%20I%20can%20start%20with%20some%20%E2%80%9Clift%20and%20shift%E2%80%9D%20methodology.%3C%2FP%3E%0A%3CH3%20id%3D%22toc-hId--957159886%22%20id%3D%22toc-hId--957159886%22%3E%3CA%20class%3D%22anchor%22%20href%3D%22https%3A%2F%2Fdev.to%2Fazure%2Fazure-cloud-shell-tips-for-sysadmins-part-ii-using-the-cloud-shell-tools-to-migrate-3ka8%23migration-strategies%22%20target%3D%22_blank%22%20rel%3D%22noopener%20nofollow%20noopener%20noreferrer%20noopener%20noreferrer%22%20name%3D%22migration-strategies%22%3E%3C%2FA%3EMigration%20Strategies%3C%2FH3%3E%0A%3CP%3EI%20brought%20up%20%E2%80%9Clift%20and%20shift%E2%80%9D%20and%20should%20really%20go%20into%20a%20bit%20more%20because%20it%E2%80%99s%20used%20a%20lot%20when%20you%20discuss%20your%20migration%20strategy.%20For%20some%20companies%2C%20completely%20refactoring%20an%20application%20to%20a%20microservices%20or%20service%20mesh%20is%20not%20feasible.%20Setting%20a%20pace%20for%20your%20migration%20as%20an%20organization%20is%20a%20long%20term%20plan%20that%20requires%20learning%20for%20many%20roles%20in%20your%20IT%20organization.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CA%20class%3D%22article-body-image-wrapper%22%20href%3D%22https%3A%2F%2Fres.cloudinary.com%2Fpracticaldev%2Fimage%2Ffetch%2Fs--E2LB8K_o--%2Fc_limit%252Cf_auto%252Cfl_progressive%252Cq_auto%252Cw_880%2Fhttps%3A%2F%2Fthepracticaldev.s3.amazonaws.com%2Fi%2F6r8g2yy6i9tevzzoucka.png%22%20target%3D%22_blank%22%20rel%3D%22noopener%20nofollow%20noopener%20noreferrer%20noopener%20noreferrer%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fres.cloudinary.com%2Fpracticaldev%2Fimage%2Ffetch%2Fs--E2LB8K_o--%2Fc_limit%252Cf_auto%252Cfl_progressive%252Cq_auto%252Cw_880%2Fhttps%3A%2F%2Fthepracticaldev.s3.amazonaws.com%2Fi%2F6r8g2yy6i9tevzzoucka.png%22%20border%3D%220%22%20alt%3D%22%22%20%2F%3E%3C%2FA%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EIf%20you%20want%20to%20migrate%20the%20right%20way%20you%20need%20to%20understand%20the%20resources%20that%20are%20available%20to%20you.%26nbsp%3B%20In%20the%20example%20of%20Microsoft%20Azure%2C%20there%20are%20nearly%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CA%20href%3D%22https%3A%2F%2Fazure.microsoft.com%2Fen-us%2Fservices%2F%3FWT.mc_id%3DITOPSTALK-blog-jagord%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noopener%20noreferrer%20noopener%20noreferrer%22%3E600%20different%20services%3C%2FA%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Ebeing%20offered%20to%20the%20user.%26nbsp%3B%20When%20determining%20how%20your%20apps%20are%20eventually%20going%20to%20run%20in%20the%20cloud%20it%E2%80%99s%20ideal%20to%20understand%20exactly%20how%20you%E2%80%99ll%20get%20them%20there.%26nbsp%3B%20The%20idea%20of%20%E2%80%9CMigrating%20and%20Modernizing%E2%80%9D%20your%20applications%20has%20a%20few%20key%20strategies%20as%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CA%20href%3D%22https%3A%2F%2Fazure.microsoft.com%2Fen-us%2Fmigration%2Fget-started%2F%3FWT.mc_id%3DITOPSTALK-blog-jagord%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noopener%20noreferrer%20noopener%20noreferrer%22%3Enoted%20in%20this%20document%20by%20Azure%3A%3C%2FA%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSTRONG%3ERehost%3C%2FSTRONG%3E-%20Often%20referred%20to%20as%20%E2%80%9Clift%20and%20shift%E2%80%9D%20migration%2C%20this%20no-code%20option%20lets%20you%20migrate%20your%20existing%20applications%20to%20Azure%20quickly.%20Each%20application%20is%20migrated%20as-is%2C%20which%20provides%20the%20benefits%20of%20the%20cloud%20without%20the%20risks%20or%20costs%20of%20making%20code%20changes.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSTRONG%3ERefactor%3C%2FSTRONG%3E-%20Often%20referred%20to%20as%20repackage%2C%20this%20cloud%20migration%20strategy%20involves%20some%20change%20to%20the%20application%20design%20but%20no%20wholesale%20changes%20to%20the%20application%20code.%20Your%20application%20can%20take%20advantage%20of%20infrastructure%20as%20a%20service%20(IaaS)%20and%20platform%20as%20a%20service%20(PaaS)%20products%2C%20such%20as%20Azure%20App%20Service%2C%20Azure%20SQL%20Database%20Managed%20Instance%2C%20and%20containers.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSTRONG%3ERearchitect%3C%2FSTRONG%3E-%20Modify%20or%20extend%20your%20application's%20code%20base%20to%20scale%20and%20optimize%20it%20for%20the%20cloud.%20Modernize%20your%20app%20into%20a%20resilient%2C%20highly%20scalable%2C%20independently%20deployable%20architecture%20and%20use%20Azure%20to%20accelerate%20the%20process%2C%20scale%20applications%20with%20confidence%2C%20and%20manage%20your%20apps%20with%20ease%E2%80%A6%3C%2FP%3E%0A%3CP%3ERebuild%20-%20Rebuild%20an%20application%20from%20scratch%20using%20cloud-native%20technologies.%20Azure%20platform%20as%20a%20service%20(PaaS)%20provides%20a%20complete%20development%20and%20deployment%20environment%20in%20the%20cloud%2C%20without%20the%20expense%20and%20complexity%20of%20software%20licenses%2C%20the%20need%20for%20underlying%20application%20infrastructure%2C%20or%20middleware%20and%20other%20resources.%20With%20this%20cloud%20migration%20strategy%2C%20you%20manage%20the%20applications%20and%20services%20you%20develop%2C%20and%20Azure%20manages%20everything%20else.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CH3%20id%3D%22toc-hId-785650449%22%20id%3D%22toc-hId-785650449%22%3EFirst%20Steps%3C%2FH3%3E%0A%3CP%3ESo%20here%20are%20a%20list%20of%20different%20ways%20of%20looking%20at%20how%20to%20migrate%20applications%20into%20the%20cloud.%26nbsp%3B%20For%20this%20situation%20I%E2%80%99ve%20leaned%20into%20some%20tools%20in%20Cloud%20Shell%20that%20are%20going%20to%20help%20me%20essentially%20%E2%80%9CRehost%E2%80%9D%20or%20%E2%80%9Clift%20and%20shift%E2%80%9D%20an%20application.%20This%20will%20be%20a%20basic%20step%20into%20the%20cloud%20that%20many%20SysAdmins%20can%20use%20to%20begin%20the%20process%20of%20building%20more%20cloud%20native%20applications.%26nbsp%3B%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EFirst%2C%20open%20a%20cloud%20shell%2C%20this%20can%20be%20done%20by%20going%20to%20the%20cloud%20shell%20logo%20in%20the%20portal%2C%20right%20of%20the%20search%20bar%20or%20navigate%20directly%20by%20going%20to%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CA%20href%3D%22https%3A%2F%2Fshell.azure.com%2F%3FWT.mc_id%3Ddevto-blog-jagord%22%20target%3D%22_blank%22%20rel%3D%22noopener%20nofollow%20noopener%20noreferrer%20noopener%20noreferrer%22%3Ehttps%3A%2F%2Fshell.azure.com%2F%3C%2FA%3E.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CA%20class%3D%22article-body-image-wrapper%22%20href%3D%22https%3A%2F%2Fres.cloudinary.com%2Fpracticaldev%2Fimage%2Ffetch%2Fs--KH4xhz3S--%2Fc_limit%252Cf_auto%252Cfl_progressive%252Cq_auto%252Cw_880%2Fhttps%3A%2F%2Fthepracticaldev.s3.amazonaws.com%2Fi%2F8tfe4fscvxsd4uedtrvn.png%22%20target%3D%22_blank%22%20rel%3D%22noopener%20nofollow%20noopener%20noreferrer%20noopener%20noreferrer%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fres.cloudinary.com%2Fpracticaldev%2Fimage%2Ffetch%2Fs--KH4xhz3S--%2Fc_limit%252Cf_auto%252Cfl_progressive%252Cq_auto%252Cw_880%2Fhttps%3A%2F%2Fthepracticaldev.s3.amazonaws.com%2Fi%2F8tfe4fscvxsd4uedtrvn.png%22%20border%3D%220%22%20alt%3D%22%22%20%2F%3E%3C%2FA%3E%3C%2FP%3E%0A%3CP%3EThe%20Azure%20Cloud%20Shell%20contains%20all%20the%20tools%20used%20in%20this%20tutorial.%26nbsp%3B%20The%20steps%20will%20be%20as%20follows%3A%3C%2FP%3E%0A%3COL%3E%0A%3CLI%3EUse%20git%20to%20get%20the%20helper%20script%20and%20ansible%20repo%20(%3CA%20href%3D%22https%3A%2F%2Fgithub.com%2Fjaydestro%2Fcreate-vm-tutorial%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noopener%20noreferrer%20noopener%20noreferrer%22%3Ecreate-vm-tutorial%3C%2FA%3E)%3C%2FLI%3E%0A%3CLI%3EReview%20the%20script%2C%20execute%20it%20from%20the%20cloud%20shell%20to%20create%20a%20Ubuntu%20LTS%20Server%3C%2FLI%3E%0A%3CLI%3EReview%20and%20execute%20the%20Ansible%20playbook%20from%20the%20cloud%20shell%20to%20install%20Node.js%3C%2FLI%3E%0A%3CLI%3ESSH%20in%2C%20deploy%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CA%20href%3D%22https%3A%2F%2Fgithub.com%2Fjaydestro%2Fdemo-app%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noopener%20noreferrer%20noopener%20noreferrer%22%3Edemo-app%3C%2FA%3E%3C%2FLI%3E%0A%3C%2FOL%3E%0A%3CP%3EFor%20this%20example%20we%E2%80%99ll%20just%20use%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CA%20href%3D%22https%3A%2F%2Fgithub.com%2Fjaydestro%2Fdemo-app%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noopener%20noreferrer%20noopener%20noreferrer%22%3Edemo-app%3C%2FA%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Eto%20show%20it%E2%80%99s%20all%20working.%26nbsp%3B%26nbsp%3B%3C%2FP%3E%0A%3CP%3EI%E2%80%99ve%20logged%20into%20my%20shell%20and%20now%20I%20will%20grab%20the%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CA%20href%3D%22https%3A%2F%2Fgithub.com%2Fjaydestro%2Fcreate-vm-tutorial%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noopener%20noreferrer%20noopener%20noreferrer%22%3Ecreate-vm-tutorial%3C%2FA%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Erepo%20that%20contains%20the%20bash%20script%20and%20Ansible%20playbook%20I%20need.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CDIV%20class%3D%22highlight%22%3E%0A%3CPRE%20class%3D%22highlight%20plaintext%22%3E%3CCODE%3Egit%20clone%20%5Bgit%40github.com%5D(mailto%3Agit%40github.com)%3Ajaydestro%2Fcreate-vm-tutorial.git%0A%0Acd%20create-vm-tutorial%2F%0A%0Ajay%40Azure%3A~%2Fcreate-vm-tutorial%24%20ls%20-al%0A%0Atotal%2024%0A%0Adrwxr-xr-x%26nbsp%3B%204%20jay%20jay%204096%20Jun%2025%2017%3A30%20.%0A%0Adrwxr-xr-x%2034%20jay%20jay%204096%20Jun%2025%2017%3A30%20..%0A%0Adrwxr-xr-x%26nbsp%3B%202%20jay%20jay%204096%20Jun%2025%2017%3A30%20ansible%0A%0A-rw-r--r--%26nbsp%3B%201%20jay%20jay%202478%20Jun%2025%2017%3A30%20create-simple-vm.sh%0A%0Adrwxr-xr-x%26nbsp%3B%208%20jay%20jay%204096%20Jun%2025%2017%3A30%20.git%0A%0A-rw-r--r--%26nbsp%3B%201%20jay%20jay%20%20838%20Jun%2025%2017%3A30%20README.md%0A%3C%2FCODE%3E%3C%2FPRE%3E%0A%3C%2FDIV%3E%0A%3CP%3ENow%20looking%20at%20the%20create-simple-vm.sh%20helper%20script%2C%20you%20can%20examine%20it%E2%80%99s%20basic%20tasks%20that%20create%20a%20resource%20group%2C%20create%20a%20VM%20and%20then%20open%20a%20few%20ports%20for%20you%20to%20ssh%20and%20bind%20the%20app%20to%20port%2080.%3C%2FP%3E%0A%3CP%3EThere%20are%20a%20few%20variables%20the%20script%20will%20ask%20you%20for%20upon%20execution.%26nbsp%3B%20It%E2%80%99s%20best%20to%20get%20the%20subscription%20ID%20first%20before%20running%20the%20script%2C%20for%20my%20security%20I%20have%20modified%20some%20of%20the%20output%3A%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CDIV%20class%3D%22highlight%22%3E%0A%3CPRE%20class%3D%22highlight%20plaintext%22%3E%3CCODE%3Eaz%20account%20show%20--out%20json%0A%3C%2FCODE%3E%3C%2FPRE%3E%0A%3C%2FDIV%3E%0A%3CDIV%20class%3D%22highlight%22%3E%0A%3CPRE%20class%3D%22highlight%20plaintext%22%3E%3CCODE%3E%7B%0A%26nbsp%3B%26nbsp%3B%22environmentName%22%3A%20%22AzureCloud%22%2C%0A%26nbsp%3B%26nbsp%3B%22id%22%3A%20%22fffffff-0000-42d3-a58b-fake%22%2C%0A%26nbsp%3B%26nbsp%3B%22isDefault%22%3A%20true%2C%0A%26nbsp%3B%26nbsp%3B%22name%22%3A%20%22ca-jagord-demo-test%22%2C%0A%26nbsp%3B%26nbsp%3B%22state%22%3A%20%22Enabled%22%2C%0A%26nbsp%3B%26nbsp%3B%22tenantId%22%3A%20%22fffffff-0000-41af-91ab-fake%22%2C%0A%26nbsp%3B%26nbsp%3B%22user%22%3A%20%7B%0A%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%22cloudShellID%22%3A%20true%2C%0A%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%22name%22%3A%20%22email%40microsoft.com%22%2C%0A%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%22type%22%3A%20%22user%22%0A%26nbsp%3B%26nbsp%3B%7D%0A%3C%2FCODE%3E%3C%2FPRE%3E%0A%3C%2FDIV%3E%0A%3CP%3ELet's%20execute%20our%20script!%3C%2FP%3E%0A%3CDIV%20class%3D%22highlight%22%3E%0A%3CPRE%20class%3D%22highlight%20plaintext%22%3E%3CCODE%3Ebash%20create-simple-vm.sh%0A%0AYour%20subscription%20ID%20can%20be%20looked%20up%20with%20the%20CLI%20using%3A%20az%20account%20show%20--out%20json%0A%3C%2FCODE%3E%3C%2FPRE%3E%0A%3C%2FDIV%3E%0A%3CP%3EEnter%20the%20subscription%20ID%20we%20just%20got%20before.%3C%2FP%3E%0A%3CDIV%20class%3D%22highlight%22%3E%0A%3CPRE%20class%3D%22highlight%20plaintext%22%3E%3CCODE%3EEnter%20your%20subscription%20ID%3A%0A%0AFffffff-0000-42d3-a58b-fake%0A%3C%2FCODE%3E%3C%2FPRE%3E%0A%3C%2FDIV%3E%0A%3CP%3EGive%20this%20a%20resource%20group%2C%20put%20everything%20into%20a%20box%20so%20we%20can%20delete%20it%20all%20at%20once!%3C%2FP%3E%0A%3CDIV%20class%3D%22highlight%22%3E%0A%3CPRE%20class%3D%22highlight%20plaintext%22%3E%3CCODE%3EEnter%20a%20name%20for%20a%20resource%20group.%20This%20script%20will%20create%20a%20new%20group%0Ajgdemo%0A%3C%2FCODE%3E%3C%2FPRE%3E%0A%3C%2FDIV%3E%0A%3CP%3EPick%20one%20of%20the%20Azure%20regions%2C%20in%20this%20case%20I%20use%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CCODE%3Eeastus%3C%2FCODE%3E%3A%3C%2FP%3E%0A%3CDIV%20class%3D%22highlight%22%3E%0A%3CPRE%20class%3D%22highlight%20plaintext%22%3E%3CCODE%3EEnter%20the%20location%20for%20this%20deployment%0AList%20of%20available%20regions%20is%20'centralus%2Ceastasia%2Csoutheastasia%2Ceastus%2Ceastus2%2Cwestus%2Cwestus2%2Cnorthcentralus%2Csouthcentralus%2Cwestcentralus%2Cnortheurope%2Cwesteurope%2Cjapaneast%2Cjapanwest%2Cbrazilsouth%2Caustraliasoutheast%2Caustraliaeast%2Cwestindia%2Csouthindia%2Ccentralindia%2Ccanadacentral%2Ccanadaeast%2Cuksouth%2Cukwest%2Ckoreacentral%2Ckoreasouth%2Cfrancecentral%2Csouthafricanorth%2Cuaenorth%0Aeastus%0A%3C%2FCODE%3E%3C%2FPRE%3E%0A%3C%2FDIV%3E%0A%3CDIV%20class%3D%22highlight%22%3E%0A%3CP%3EGive%20the%20server%20a%20name!%3C%2FP%3E%0A%3CDIV%20class%3D%22highlight%22%3E%0A%3CPRE%20class%3D%22highlight%20plaintext%22%3E%3CCODE%3EEnter%20front%20end%20VM%20name%3A%0Ajgdemoserver%0A%3C%2FCODE%3E%3C%2FPRE%3E%0A%3C%2FDIV%3E%0A%3CP%3EAfter%20these%20variables%20are%20entered%2C%20you%E2%80%99ll%20begin%20the%20process%20of%20provisioning%20the%20resource%20group%20and%20VM.%20You%20should%20see%20some%20output%20similar%20to%20this%20for%20each%20step%3A%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CA%20class%3D%22article-body-image-wrapper%22%20href%3D%22https%3A%2F%2Fres.cloudinary.com%2Fpracticaldev%2Fimage%2Ffetch%2Fs--r4vOBppP--%2Fc_limit%252Cf_auto%252Cfl_progressive%252Cq_auto%252Cw_880%2Fhttps%3A%2F%2Fthepracticaldev.s3.amazonaws.com%2Fi%2Fqftdd37qof0tos3j37h6.png%22%20target%3D%22_blank%22%20rel%3D%22noopener%20nofollow%20noopener%20noreferrer%20noopener%20noreferrer%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fres.cloudinary.com%2Fpracticaldev%2Fimage%2Ffetch%2Fs--r4vOBppP--%2Fc_limit%252Cf_auto%252Cfl_progressive%252Cq_auto%252Cw_880%2Fhttps%3A%2F%2Fthepracticaldev.s3.amazonaws.com%2Fi%2Fqftdd37qof0tos3j37h6.png%22%20border%3D%220%22%20alt%3D%22%22%20%2F%3E%3C%2FA%3E%3C%2FP%3E%0A%3CP%3EAfter%20only%20about%20sixty%20seconds%20I%20get%20the%20output%20info%20for%20my%20new%20UbuntuLTS%20Server%3A%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CA%20class%3D%22article-body-image-wrapper%22%20href%3D%22https%3A%2F%2Fres.cloudinary.com%2Fpracticaldev%2Fimage%2Ffetch%2Fs--rL4XfBh---%2Fc_limit%252Cf_auto%252Cfl_progressive%252Cq_auto%252Cw_880%2Fhttps%3A%2F%2Fthepracticaldev.s3.amazonaws.com%2Fi%2Ffixpcut39qyt7apv19vu.png%22%20target%3D%22_blank%22%20rel%3D%22noopener%20nofollow%20noopener%20noreferrer%20noopener%20noreferrer%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fres.cloudinary.com%2Fpracticaldev%2Fimage%2Ffetch%2Fs--rL4XfBh---%2Fc_limit%252Cf_auto%252Cfl_progressive%252Cq_auto%252Cw_880%2Fhttps%3A%2F%2Fthepracticaldev.s3.amazonaws.com%2Fi%2Ffixpcut39qyt7apv19vu.png%22%20border%3D%220%22%20alt%3D%22%22%20%2F%3E%3C%2FA%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EAs%20you%20can%20see%20the%20VM%20is%20provided%20a%20fully%20qualified%20domain%20name%20and%20a%20public%20IP%20address%20upon%20deployment.%20I%20have%20specified%20that%20ssh%20keys%20be%20created%20for%20me%20and%20that%20the%20user%20%E2%80%98azureuser%E2%80%99%20is%20created%20with%20sudo%20rights.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EThe%20script%20will%20go%20on%20to%20open%20port%2080%20for%20our%20demo-app%20that%20will%20eventually%20be%20served%20from%20for%20http%20access.%20When%20completed%20the%20script%20will%20provide%20you%20with%20%E2%80%9Cdestroy%E2%80%9D%20commands%3A%3C%2FP%3E%0A%3CDIV%20class%3D%22highlight%22%3E%0A%3CPRE%20class%3D%22highlight%20plaintext%22%3E%3CCODE%3EYoure%20done%2C%20when%20youre%20ready%20to%20delete%20this%2C%20execute%20this%20command%20in%20Cloud%20Shell%0Aaz%20group%20delete%20-g%20jgdemo%0A%3C%2FCODE%3E%3C%2FPRE%3E%0A%3C%2FDIV%3E%0A%3CP%3EHang%20on%20to%20that%20command%2C%20it%20becomes%20useful%20when%20you%20want%20to%20throw%20that%20box%20of%20resources%20away.%3C%2FP%3E%0A%3CP%3EUse%20the%20VM%E2%80%99s%20public%20IP%20address%2C%20to%20get%20that%20you%20can%20run%20this%20command%20in%20the%20cloud%20shell%20with%20your%20resource%20group%20(I%E2%80%99ve%20just%20modified%20the%20IP%20address%20for%20the%20example)%3A%3C%2FP%3E%0A%3CDIV%20class%3D%22highlight%22%3E%0A%3CPRE%20class%3D%22highlight%20plaintext%22%3E%3CCODE%3Eaz%20vm%20list-ip-addresses%20-g%20%24RESOURCEGROUP%20%7C%20grep%20ipAddress%0A%0A%20%20%20%20%20%20%20%20%20%20%20%20%22ipAddress%22%3A%20%221.2.3.4%22%2C%0A%3C%2FCODE%3E%3C%2FPRE%3E%0A%3C%2FDIV%3E%0A%3CP%3ENow%20that%20I%20have%20my%20IP%20address%2C%20I%20am%20ready%20to%20create%20an%20inventory%20host%20file%20for%20ansible%20to%20run.%20Let%E2%80%99s%20create%20a%20simple%20one%20with%20this%20command%20into%20my%20shell%3A%3C%2FP%3E%0A%3CDIV%20class%3D%22highlight%22%3E%0A%3CPRE%20class%3D%22highlight%20plaintext%22%3E%3CCODE%3Emkdir%20~%2F.ansible%2F%20%0Acode%20%20~%2F.ansible%2Fhosts%0A%3C%2FCODE%3E%3C%2FPRE%3E%0A%3C%2FDIV%3E%0A%3CP%3Ethe%20contents%20of%20the%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CCODE%3E~%2F.ansible%2Fhosts%3C%2FCODE%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Einventory%20file%3A%3C%2FP%3E%0A%3CDIV%20class%3D%22highlight%22%3E%0A%3CPRE%20class%3D%22highlight%20plaintext%22%3E%3CCODE%3E%5Bhosts%5D%0A1.2.3.4%0A%3C%2FCODE%3E%3C%2FPRE%3E%0A%3C%2FDIV%3E%0A%3CP%3ESave%20the%20file%20and%20close%20the%20code%20editor.%20Now%20let%E2%80%99s%20go%20into%20the%20ansible%20directory%20in%20the%20repo%3A%3C%2FP%3E%0A%3CDIV%20class%3D%22highlight%22%3E%0A%3CPRE%20class%3D%22highlight%20plaintext%22%3E%3CCODE%3Ecd%20ansible%0A%3C%2FCODE%3E%3C%2FPRE%3E%0A%3C%2FDIV%3E%0A%3CP%3EThe%20install_node.yaml%20ansible%20playbook%20contains%20directions%20to%20install%20a%20gpg%20key%20to%20permit%20new%20packages%20on%20the%20Operating%20System%20to%20be%20installed.%20Then%20it%20will%20install%20the%20LTS%20version%20of%20Node.js%3A%3C%2FP%3E%0A%3CDIV%20class%3D%22highlight%22%3E%0A%3CPRE%20class%3D%22highlight%20plaintext%22%3E%3CCODE%3Eansible-playbook%20--inventory-file%3D~%2F.ansible%2Fhosts%20-u%20azureuser%20install_node.yaml%0A%3C%2FCODE%3E%3C%2FPRE%3E%0A%3C%2FDIV%3E%0A%3CP%3E%3CA%20class%3D%22article-body-image-wrapper%22%20href%3D%22https%3A%2F%2Fres.cloudinary.com%2Fpracticaldev%2Fimage%2Ffetch%2Fs--1OmVbF3t--%2Fc_limit%252Cf_auto%252Cfl_progressive%252Cq_auto%252Cw_880%2Fhttps%3A%2F%2Fthepracticaldev.s3.amazonaws.com%2Fi%2Ftlfjzzduo2wpkriqjkks.png%22%20target%3D%22_blank%22%20rel%3D%22noopener%20nofollow%20noopener%20noreferrer%20noopener%20noreferrer%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fres.cloudinary.com%2Fpracticaldev%2Fimage%2Ffetch%2Fs--1OmVbF3t--%2Fc_limit%252Cf_auto%252Cfl_progressive%252Cq_auto%252Cw_880%2Fhttps%3A%2F%2Fthepracticaldev.s3.amazonaws.com%2Fi%2Ftlfjzzduo2wpkriqjkks.png%22%20border%3D%220%22%20alt%3D%22%22%20%2F%3E%3C%2FA%3E%3C%2FP%3E%0A%3CP%3ELet%E2%80%99s%20ssh%20in%20and%20take%20a%20look!%3C%2FP%3E%0A%3CDIV%20class%3D%22highlight%22%3E%0A%3CPRE%20class%3D%22highlight%20plaintext%22%3E%3CCODE%3E%20ssh%20-l%20azureuser%2040.117.152.205%0A%0Aazureuser%40jgdemoserver%3A~%24%20npm%20-v%0A6.4.1%0Aazureuser%40jgdemoserver%3A~%24%20node%20-v%0Av8.16.0%0A%0A%3C%2FCODE%3E%3C%2FPRE%3E%0A%3C%2FDIV%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EPretty%20cool%2C%20let%E2%80%99s%20do%20the%20last%20step.%20App%20deploy%20time!%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EGet%20the%20demo-app%20repo%20and%20clone%20it%20to%20your%20home%20directory%3A%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CDIV%20class%3D%22highlight%22%3E%0A%3CPRE%20class%3D%22highlight%20plaintext%22%3E%3CCODE%3Egit%20clone%20https%3A%2F%2Fgithub.com%2Fjaydestro%2Fdemo-app.git%0Acd%20demo-app%20%0Anpm%20install%0Asudo%20npm%20start%0A%0A%3C%2FCODE%3E%3C%2FPRE%3E%0A%3C%2FDIV%3E%0A%3CP%3ENow%20let%E2%80%99s%20check%2040.117.152.205%20in%20a%20browser%3A%3C%2FP%3E%0A%3CP%3E%3CA%20class%3D%22article-body-image-wrapper%22%20href%3D%22https%3A%2F%2Fres.cloudinary.com%2Fpracticaldev%2Fimage%2Ffetch%2Fs--Zk6M3hFC--%2Fc_limit%252Cf_auto%252Cfl_progressive%252Cq_auto%252Cw_880%2Fhttps%3A%2F%2Fthepracticaldev.s3.amazonaws.com%2Fi%2F1j6pa9r1o57lhvro9rxd.png%22%20target%3D%22_blank%22%20rel%3D%22noopener%20nofollow%20noopener%20noreferrer%20noopener%20noreferrer%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fres.cloudinary.com%2Fpracticaldev%2Fimage%2Ffetch%2Fs--Zk6M3hFC--%2Fc_limit%252Cf_auto%252Cfl_progressive%252Cq_auto%252Cw_880%2Fhttps%3A%2F%2Fthepracticaldev.s3.amazonaws.com%2Fi%2F1j6pa9r1o57lhvro9rxd.png%22%20border%3D%220%22%20alt%3D%22%22%20%2F%3E%3C%2FA%3E%3C%2FP%3E%0A%3CH3%20id%3D%22toc-hId--1766506512%22%20id%3D%22toc-hId--1766506512%22%3E%3CA%20class%3D%22anchor%22%20href%3D%22https%3A%2F%2Fdev.to%2Fazure%2Fazure-cloud-shell-tips-for-sysadmins-part-ii-using-the-cloud-shell-tools-to-migrate-3ka8%23done-and-demolition%22%20target%3D%22_blank%22%20rel%3D%22noopener%20nofollow%20noopener%20noreferrer%20noopener%20noreferrer%22%20name%3D%22done-and-demolition%22%3E%3C%2FA%3EDone%20and%20Demolition%3C%2FH3%3E%0A%3CP%3EThat%E2%80%99s%20everything!%20The%20whole%20kit-and-kaboodle%20of%20getting%20a%20basic%20application%20on%20with%20the%20tools%20already%20built%20into%20the%20Azure%20Cloud%20Shell.%20You%20can%20store%20everything%20you%20create%20for%20your%20repository%20on%20your%20Cloud%20Shell%20and%20then%20create%20an%20ssh%20key%20to%20sync%20your%20repos%20with%20your%20Github%20or%20Azure%20DevOps%20repositories.%3C%2FP%3E%0A%3CP%3EDestroying%20it%20all!%20Remember%20back%20when%20I%20said%20to%20%E2%80%9Ckeep%20that%20command%E2%80%9D%20Let%E2%80%99s%20blow%20it%20all%20up%20and%20destroy%20our%20demo%20infrastructure%3A%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CDIV%20class%3D%22highlight%22%3E%0A%3CPRE%20class%3D%22highlight%20plaintext%22%3E%3CCODE%3Eaz%20group%20delete%20-g%20jgdemo%20%0AAre%20you%20sure%20you%20want%20to%20perform%20this%20operation%3F%20(y%2Fn)%3A%20y%0A%3C%2FCODE%3E%3C%2FPRE%3E%0A%3C%2FDIV%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EYou%E2%80%99ll%20then%20see%20%E2%80%9CRunning%E2%80%A6%E2%80%9D%20until%20the%20group%20deletion%20process%20is%20completed.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EThere%E2%80%99s%20a%20ton%20of%20information%20in%20this%20tutorial.%26nbsp%3B%20It%E2%80%99s%20meant%20to%20give%20the%20user%20who%20may%20be%20really%20not%20certain%20how%20to%20do%20some%20of%20these%20%E2%80%9Clift%20and%20shift%E2%80%9D%20tasks%20a%20first%20start%20in%20their%20world%20in%20the%20Cloud.%26nbsp%3B%20Migrating%20to%20the%20cloud%20can%20be%20a%20huge%20undertaking%2C%20so%20having%20beginners%20info%20can%20really%20help.%20If%20you%20run%20into%20any%20issues%2C%20feel%20free%20to%20reach%20out%20to%20me%20on%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CA%20href%3D%22https%3A%2F%2Ftwitter.com%2Fjaydestro%22%20target%3D%22_blank%22%20rel%3D%22noopener%20nofollow%20noopener%20noreferrer%20noopener%20noreferrer%22%3ETwitter%20%40jaydestro%3C%2FA%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Eor%20here%20in%20the%20comments.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3C%2FDIV%3E%0A%3CH3%20id%3D%22toc-hId--23696177%22%20id%3D%22toc-hId--23696177%22%3E%3CA%20class%3D%22anchor%22%20href%3D%22https%3A%2F%2Fdev.to%2Fazure%2Fazure-cloud-shell-tips-for-sysadmins-part-ii-using-the-cloud-shell-tools-to-migrate-3ka8%23first-steps%22%20target%3D%22_blank%22%20rel%3D%22noopener%20nofollow%20noopener%20noreferrer%20noopener%20noreferrer%22%20name%3D%22first-steps%22%3E%3C%2FA%3E%3C%2FH3%3E%3C%2FLINGO-BODY%3E%3CLINGO-TEASER%20id%3D%22lingo-teaser-734965%22%20slang%3D%22en-US%22%3E%3CP%3EIn%20my%20last%20blog%20post%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2FITOps-Talk-Blog%2FAzure-Cloud-Shell-Tips-for-SysAdmins-Part-I-Bash-and-tools-for%2Fba-p%2F734958%22%20target%3D%22_self%22%3EAzure%20Cloud%20Shell%20Tips%20for%20SysAdmins%20(bash)%3C%2FA%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3EI%20discussed%20some%20of%20the%20tools%20that%20the%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fazure%2Fcloud-shell%2Fquickstart%3FWT.mc_id%3DITOPSTALK-blog-jagord%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noopener%20noreferrer%20noopener%20noreferrer%22%3EAzure%20Cloud%20Shell%20for%20bash%3C%2FA%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Ealready%20has%20built%20into%20it.%26nbsp%3B%20This%20time%20I%20will%20go%20a%20bit%20deeper%20and%20show%20you%20how%20to%20utilize%20a%20combination%20of%20the%20tools%20to%20create%20an%20UbuntuLTS%20Linux%20server.%26nbsp%3B%20Once%20the%20server%20is%20provisioned%2C%20I%20will%20demonstrate%20how%20to%20use%20Ansible%20to%20deploy%20Node.js%20from%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CA%20href%3D%22https%3A%2F%2Fgithub.com%2Fnodesource%2Fdistributions%22%20target%3D%22_self%22%20rel%3D%22noopener%20noreferrer%20noopener%20noreferrer%22%3Ethe%20nodesource%20binary%20repository.%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-TEASER%3E%3CLINGO-LABS%20id%3D%22lingo-labs-734965%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EAzure%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EBash%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3ECloud%20Shell%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EOps%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E
Microsoft

As an Azure Advocate, one of the things I spend my time doing is learning the easiest ways for beginners to use Microsoft Azure. Today I want to share with you a few ways to utilize some tools that are built right into Azure.

 

In my last blog post Azure Cloud Shell Tips for SysAdmins (bash) I discussed some of the tools that the Azure Cloud Shell for bash already has built into it.  This time I will go a bit deeper and show you how to utilize a combination of the tools to create an UbuntuLTS Linux server.  Once the server is provisioned, I will demonstrate how to use Ansible to deploy Node.js from the nodesource binary repository. 

 

Requirements for tutorial:

  • Azure Account
  • Azure Cloud Shell (bash)
  • Some SSH and text editing

What’s the point of all this?

Good question.  From my travels as a Cloud Advocate, I really have noticed that many users who’ve come from the world of System Administration need the tools and tutorials to walk before they can run.  It’s great to use Kubernetes to orchestrate a complex distributed system. But if that’s not quite where you are in the steps of moving to the cloud, I can start with some “lift and shift” methodology.

Migration Strategies

I brought up “lift and shift” and should really go into a bit more because it’s used a lot when you discuss your migration strategy. For some companies, completely refactoring an application to a microservices or service mesh is not feasible. Setting a pace for your migration as an organization is a long term plan that requires learning for many roles in your IT organization.

 

 

If you want to migrate the right way you need to understand the resources that are available to you.  In the example of Microsoft Azure, there are nearly 600 different services being offered to the user.  When determining how your apps are eventually going to run in the cloud it’s ideal to understand exactly how you’ll get them there.  The idea of “Migrating and Modernizing” your applications has a few key strategies as noted in this document by Azure:

 

Rehost - Often referred to as “lift and shift” migration, this no-code option lets you migrate your existing applications to Azure quickly. Each application is migrated as-is, which provides the benefits of the cloud without the risks or costs of making code changes.

 

Refactor - Often referred to as repackage, this cloud migration strategy involves some change to the application design but no wholesale changes to the application code. Your application can take advantage of infrastructure as a service (IaaS) and platform as a service (PaaS) products, such as Azure App Service, Azure SQL Database Managed Instance, and containers.

 

Rearchitect - Modify or extend your application's code base to scale and optimize it for the cloud. Modernize your app into a resilient, highly scalable, independently deployable architecture and use Azure to accelerate the process, scale applications with confidence, and manage your apps with ease…

Rebuild - Rebuild an application from scratch using cloud-native technologies. Azure platform as a service (PaaS) provides a complete development and deployment environment in the cloud, without the expense and complexity of software licenses, the need for underlying application infrastructure, or middleware and other resources. With this cloud migration strategy, you manage the applications and services you develop, and Azure manages everything else.

 

First Steps

So here are a list of different ways of looking at how to migrate applications into the cloud.  For this situation I’ve leaned into some tools in Cloud Shell that are going to help me essentially “Rehost” or “lift and shift” an application. This will be a basic step into the cloud that many SysAdmins can use to begin the process of building more cloud native applications.  

 

First, open a cloud shell, this can be done by going to the cloud shell logo in the portal, right of the search bar or navigate directly by going to https://shell.azure.com/.

 

The Azure Cloud Shell contains all the tools used in this tutorial.  The steps will be as follows:

  1. Use git to get the helper script and ansible repo (create-vm-tutorial)
  2. Review the script, execute it from the cloud shell to create a Ubuntu LTS Server
  3. Review and execute the Ansible playbook from the cloud shell to install Node.js
  4. SSH in, deploy demo-app

For this example we’ll just use demo-app to show it’s all working.  

I’ve logged into my shell and now I will grab the create-vm-tutorial repo that contains the bash script and Ansible playbook I need.

 

git clone [git@github.com](mailto:git@github.com):jaydestro/create-vm-tutorial.git

cd create-vm-tutorial/

jay@Azure:~/create-vm-tutorial$ ls -al

total 24

drwxr-xr-x  4 jay jay 4096 Jun 25 17:30 .

drwxr-xr-x 34 jay jay 4096 Jun 25 17:30 ..

drwxr-xr-x  2 jay jay 4096 Jun 25 17:30 ansible

-rw-r--r--  1 jay jay 2478 Jun 25 17:30 create-simple-vm.sh

drwxr-xr-x  8 jay jay 4096 Jun 25 17:30 .git

-rw-r--r--  1 jay jay  838 Jun 25 17:30 README.md

Now looking at the create-simple-vm.sh helper script, you can examine it’s basic tasks that create a resource group, create a VM and then open a few ports for you to ssh and bind the app to port 80.

There are a few variables the script will ask you for upon execution.  It’s best to get the subscription ID first before running the script, for my security I have modified some of the output:

 

az account show --out json
{
  "environmentName": "AzureCloud",
  "id": "fffffff-0000-42d3-a58b-fake",
  "isDefault": true,
  "name": "ca-jagord-demo-test",
  "state": "Enabled",
  "tenantId": "fffffff-0000-41af-91ab-fake",
  "user": {
    "cloudShellID": true,
    "name": "email@microsoft.com",
    "type": "user"
  }

Let's execute our script!

bash create-simple-vm.sh

Your subscription ID can be looked up with the CLI using: az account show --out json

Enter the subscription ID we just got before.

Enter your subscription ID:

Fffffff-0000-42d3-a58b-fake

Give this a resource group, put everything into a box so we can delete it all at once!

Enter a name for a resource group. This script will create a new group
jgdemo

Pick one of the Azure regions, in this case I use eastus:

Enter the location for this deployment
List of available regions is 'centralus,eastasia,southeastasia,eastus,eastus2,westus,westus2,northcentralus,southcentralus,westcentralus,northeurope,westeurope,japaneast,japanwest,brazilsouth,australiasoutheast,australiaeast,westindia,southindia,centralindia,canadacentral,canadaeast,uksouth,ukwest,koreacentral,koreasouth,francecentral,southafricanorth,uaenorth
eastus

Give the server a name!

Enter front end VM name:
jgdemoserver

After these variables are entered, you’ll begin the process of provisioning the resource group and VM. You should see some output similar to this for each step:

 

After only about sixty seconds I get the output info for my new UbuntuLTS Server:

 

 

As you can see the VM is provided a fully qualified domain name and a public IP address upon deployment. I have specified that ssh keys be created for me and that the user ‘azureuser’ is created with sudo rights.

 

The script will go on to open port 80 for our demo-app that will eventually be served from for http access. When completed the script will provide you with “destroy” commands:

Youre done, when youre ready to delete this, execute this command in Cloud Shell
az group delete -g jgdemo

Hang on to that command, it becomes useful when you want to throw that box of resources away.

Use the VM’s public IP address, to get that you can run this command in the cloud shell with your resource group (I’ve just modified the IP address for the example):

az vm list-ip-addresses -g $RESOURCEGROUP | grep ipAddress

            "ipAddress": "1.2.3.4",

Now that I have my IP address, I am ready to create an inventory host file for ansible to run. Let’s create a simple one with this command into my shell:

mkdir ~/.ansible/ 
code  ~/.ansible/hosts

the contents of the ~/.ansible/hosts inventory file:

[hosts]
1.2.3.4

Save the file and close the code editor. Now let’s go into the ansible directory in the repo:

cd ansible

The install_node.yaml ansible playbook contains directions to install a gpg key to permit new packages on the Operating System to be installed. Then it will install the LTS version of Node.js:

ansible-playbook --inventory-file=~/.ansible/hosts -u azureuser install_node.yaml

Let’s ssh in and take a look!

 ssh -l azureuser 40.117.152.205

azureuser@jgdemoserver:~$ npm -v
6.4.1
azureuser@jgdemoserver:~$ node -v
v8.16.0

 

Pretty cool, let’s do the last step. App deploy time!

 

Get the demo-app repo and clone it to your home directory:

 

git clone https://github.com/jaydestro/demo-app.git
cd demo-app 
npm install
sudo npm start

Now let’s check 40.117.152.205 in a browser:

Done and Demolition

That’s everything! The whole kit-and-kaboodle of getting a basic application on with the tools already built into the Azure Cloud Shell. You can store everything you create for your repository on your Cloud Shell and then create an ssh key to sync your repos with your Github or Azure DevOps repositories.

Destroying it all! Remember back when I said to “keep that command” Let’s blow it all up and destroy our demo infrastructure:

 

az group delete -g jgdemo 
Are you sure you want to perform this operation? (y/n): y

 

You’ll then see “Running…” until the group deletion process is completed.

 

There’s a ton of information in this tutorial.  It’s meant to give the user who may be really not certain how to do some of these “lift and shift” tasks a first start in their world in the Cloud.  Migrating to the cloud can be a huge undertaking, so having beginners info can really help. If you run into any issues, feel free to reach out to me on Twitter @jaydestro or here in the comments.