Home
%3CLINGO-SUB%20id%3D%22lingo-sub-734969%22%20slang%3D%22en-US%22%3EAzure%20Cloud%20Shell%20Tips%20for%20SysAdmins%3A%20Part%20III%20-%20Using%20Azure%20CLI%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-734969%22%20slang%3D%22en-US%22%3E%3CDIV%20id%3D%22article-body%22%20class%3D%22body%22%20data-article-id%3D%22128960%22%3E%0A%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-II-Using-the-Cloud%2Fba-p%2F734965%22%20target%3D%22_blank%22%20rel%3D%22noopener%22%3EAzure%20Cloud%20Shell%20Tips%20for%20SysAdmins%20Part%20II%20-%20Using%20the%20Cloud%20Shell%20tools%20to%20Migrate%3C%2FA%3E%2C%20I%20use%20some%20of%20the%20tools%20that%20are%20part%20of%20the%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fazure%2Fcloud-shell%2Fquickstart%3FWT.mc_id%3Dhttps%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.%20This%20time%2C%20I'll%20give%20you%20some%20quick%20tips%20on%20working%20with%20the%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fazure%2Fazure-resource-manager%2Fresource-group-overview%2F%3FWT.mc_id%3Dhttps%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%20Resource%20Manager%3C%2FA%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Efor%20information%20and%20to%20modify%20a%20newly%20created%20VM.%20I%20will%20be%20using%20the%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fcli%2Fazure%2Fget-started-with-azure-cli%3FWT.mc_id%3Dhttps%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%20CLI%3C%2FA%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Etool%20that's%20ready%20in%20Azure%20Cloud%20Shell.%3C%2FP%3E%0A%3CH3%20id%3D%22toc-hId-1594997050%22%20id%3D%22toc-hId-1594997050%22%3E%3CA%20class%3D%22anchor%22%20href%3D%22https%3A%2F%2Fdev.to%2Fazure%2Fazure-cloud-shell-tips-for-sysadmins-part-iii-using-azure-cli-for-server-details-9dd%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%3EFirst%20Steps%3C%2FH3%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%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%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EThe%20Azure%20Cloud%20Shell%20contains%20all%20the%20tools%20used%20in%20this%20tutorial.%20You%20can%20install%20the%20Azure%20CLI%20locally%20by%20following%20the%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fcli%2Fazure%2Finstall-azure-cli%3FWT.mc_id%3Dhttps%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%3Einstructions%20for%20your%20operating%20system.%3C%2FA%3E%3C%2FP%3E%0A%3CH3%20id%3D%22toc-hId--957159911%22%20id%3D%22toc-hId--957159911%22%3E%3CA%20class%3D%22anchor%22%20href%3D%22https%3A%2F%2Fdev.to%2Fazure%2Fazure-cloud-shell-tips-for-sysadmins-part-iii-using-azure-cli-for-server-details-9dd%23using-azure-cli%22%20target%3D%22_blank%22%20rel%3D%22noopener%20nofollow%20noopener%20noreferrer%20noopener%20noreferrer%22%20name%3D%22using-azure-cli%22%3E%3C%2FA%3EUsing%20Azure%20CLI%3C%2FH3%3E%0A%3CP%3ELet's%20run%20through%20a%20series%20of%20tasks%20you%20may%20need%20to%20do%20to%20create%20a%20new%20Linux%20server%20using%20Azure%20CLI.%3C%2FP%3E%0A%3CH3%20id%3D%22toc-hId-785650424%22%20id%3D%22toc-hId-785650424%22%3E%3CA%20class%3D%22anchor%22%20href%3D%22https%3A%2F%2Fdev.to%2Fazure%2Fazure-cloud-shell-tips-for-sysadmins-part-iii-using-azure-cli-for-server-details-9dd%23create-a-resource-group%22%20target%3D%22_blank%22%20rel%3D%22noopener%20nofollow%20noopener%20noreferrer%20noopener%20noreferrer%22%20name%3D%22create-a-resource-group%22%3E%3C%2FA%3ECreate%20a%20resource%20group.%3C%2FH3%3E%0A%3CP%3EI%20like%20to%20think%20of%20a%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fazure%2Fazure-resource-manager%2Fresource-group-overview%23resource-groups%3FWT.mc_id%3Dhttps%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%3Eresource%20group%3C%2FA%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Eas%20a%20big%20box%20where%20you%20can%20put%20all%20of%20your%20Azure%20resources.%20When%20I%20am%20finished%20with%20the%20box%2C%20I%20can%20throw%20it%20away%20into%20a%20dumpster%20and%20move%20on.%20I%20won't%20have%20to%20spend%20time%20deleting%20each%20individual%20resource%20when%20I%20am%20finished.%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--wTciEgA7--%2Fc_limit%252Cf_auto%252Cfl_progressive%252Cq_auto%252Cw_880%2Fhttps%3A%2F%2Fthepracticaldev.s3.amazonaws.com%2Fi%2Frfbjlko9lcer264wdrzz.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--wTciEgA7--%2Fc_limit%252Cf_auto%252Cfl_progressive%252Cq_auto%252Cw_880%2Fhttps%3A%2F%2Fthepracticaldev.s3.amazonaws.com%2Fi%2Frfbjlko9lcer264wdrzz.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%3ECreating%20a%20resource%20group%20requires%20you%20provide%20at%20a%20minimum%20two%20pieces%20of%20information%20required%20to%20create%20the%20group.%3C%2FP%3E%0A%3CUL%3E%0A%3CLI%3EName%20-%20Literally%20what%20you%20want%20the%20resource%20group's%20name%20to%20be%3C%2FLI%3E%0A%3CLI%3ELocation%20-%20This%20is%20where%20metadata%20about%20your%20resource%20group%20will%20be%20stored.%20This%20could%20be%20important%20for%20those%20who%20may%20require%20all%20of%20your%20infrastructure's%20data%20be%20stored%20in%20a%20specific%20country%20due%20to%20compliance.%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3CP%3EAnother%20optional%20setting%20is%20Subscription%20that%20permits%20the%20user%20to%20state%20which%20billing%20subscription%20the%20resource%20group%20will%20belong%20to.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3ETo%20create%20a%20resource%20group%20named%20%22devtoapp%22%20in%20the%20East%20US%20region%20of%20Azure%2C%20I%20will%20execute%20the%20following%20command%3A%3C%2FP%3E%0A%3CDIV%20class%3D%22highlight%22%3E%0A%3CPRE%20class%3D%22highlight%20plaintext%22%3E%3CCODE%3Eaz%20group%20create%20--location%20eastus%20--name%20devtoapp%0A%3C%2FCODE%3E%3C%2FPRE%3E%0A%3C%2FDIV%3E%0A%3CP%3EThe%20Azure%20Resource%20Manager%20will%20then%20create%20your%20group%20and%20provide%20you%20with%20a%20JSON%20output%20of%20what%20was%20created%3A%3C%2FP%3E%0A%3CDIV%20class%3D%22highlight%22%3E%0A%3CPRE%20class%3D%22highlight%20plaintext%22%3E%3CCODE%3E%7B%0A%20%20%22id%22%3A%20%22%2Fsubscriptions%2Ffakefakefake-54cc-0000-a58b-87afakefakefake7ad%2FresourceGroups%2Fdevtoapp%22%2C%0A%20%20%22location%22%3A%20%22eastus%22%2C%0A%20%20%22managedBy%22%3A%20null%2C%0A%20%20%22name%22%3A%20%22devtoapp%22%2C%0A%20%20%22properties%22%3A%20%7B%0A%20%20%20%20%22provisioningState%22%3A%20%22Succeeded%22%0A%20%20%7D%2C%0A%20%20%22tags%22%3A%20null%2C%0A%20%20%22type%22%3A%20null%0A%7D%0A%3C%2FCODE%3E%3C%2FPRE%3E%0A%3C%2FDIV%3E%0A%3CP%3ELooks%20like%20I%20forgot%20to%20set%20a%20tag%20to%20say%20this%20is%20my%20%22dev%22%20environment%20-%20let's%20update%20that%3A%3C%2FP%3E%0A%3CDIV%20class%3D%22highlight%22%3E%0A%3CPRE%20class%3D%22highlight%20plaintext%22%3E%3CCODE%3Eaz%20group%20update%20--name%20devtoapp%20--set%20tags.Details%3D'%7B%22Environment%22%3A%22dev%22%7D'%0A%3C%2FCODE%3E%3C%2FPRE%3E%0A%3C%2FDIV%3E%0A%3CP%3EI've%20told%20Azure%20Resource%20Manager%20to%20update%20the%20metadata%20associated%20with%20my%20group%20to%20include%20a%20tag%20about%20my%20environment.%3C%2FP%3E%0A%3CDIV%20class%3D%22highlight%22%3E%0A%3CPRE%20class%3D%22highlight%20plaintext%22%3E%3CCODE%3E%7B%0A%20%20%22id%22%3A%20%22%2Fsubscriptions%2Ffakefakefake-54cc-0000-a58b-87afakefakefake7ad%2FresourceGroups%2Fdevtoapp%22%2C%0A%20%20%22location%22%3A%20%22eastus%22%2C%0A%20%20%22managedBy%22%3A%20null%2C%0A%20%20%22name%22%3A%20%22devtoapp%22%2C%0A%20%20%22properties%22%3A%20%7B%0A%20%20%20%20%22provisioningState%22%3A%20%22Succeeded%22%0A%20%20%7D%2C%0A%20%20%22tags%22%3A%20%7B%0A%20%20%20%20%22Details%22%3A%20%22%7B'Environment'%3A%20'dev'%7D%22%0A%20%20%7D%2C%0A%20%20%22type%22%3A%20null%0A%7D%0A%3C%2FCODE%3E%3C%2FPRE%3E%0A%3C%2FDIV%3E%0A%3CP%3EDone!%20Let's%20put%20some%20resources%20in%20this%20group!%3C%2FP%3E%0A%3CH3%20id%3D%22toc-hId--1766506537%22%20id%3D%22toc-hId--1766506537%22%3E%3CA%20class%3D%22anchor%22%20href%3D%22https%3A%2F%2Fdev.to%2Fazure%2Fazure-cloud-shell-tips-for-sysadmins-part-iii-using-azure-cli-for-server-details-9dd%23create-a-vm%22%20target%3D%22_blank%22%20rel%3D%22noopener%20nofollow%20noopener%20noreferrer%20noopener%20noreferrer%22%20name%3D%22create-a-vm%22%3E%3C%2FA%3ECreate%20a%20VM%3C%2FH3%3E%0A%3CP%3EIn%20my%20last%20blog%2C%20I%20did%20all%20the%20work%20for%20the%20reader%20by%20providing%20you%20with%20a%20script%20that%20handled%20all%20the%20creation%20of%20the%20VM.%20This%20time%20around%2C%20I'd%20like%20to%20show%20the%20command%20and%20explain%20what's%20being%20passed%20to%20the%20Azure%20Resource%20Manager.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EBefore%20I%20run%20this%2C%20I%20want%20to%20explain%20what%20I%20am%20doing%20by%20executing%20the%20command%20in%20my%20Cloud%20Shell.%3C%2FP%3E%0A%3CP%3E%3CSTRONG%3E%3CCODE%3Eaz%20vm%20create%3C%2FCODE%3E%3C%2FSTRONG%3E%3CBR%20%2F%3EI%20want%20to%20create%20a%20VM%3CBR%20%2F%3E%3CSTRONG%3E%3CCODE%3E--resource-group%20devtoapp%3C%2FCODE%3E%3C%2FSTRONG%3E%3CBR%20%2F%3EI%20want%20to%20put%20this%20new%20VM%20in%20the%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CCODE%3Edevtoapp%3C%2FCODE%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Eresource%20group%3CBR%20%2F%3E%3CSTRONG%3E%3CCODE%3E--name%20devtoappvm%3C%2FCODE%3E%3C%2FSTRONG%3E%3CBR%20%2F%3EThe%20name%20of%20my%20new%20VM%20should%20be%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CCODE%3Edevtoappvm%3C%2FCODE%3E%3CBR%20%2F%3E%3CSTRONG%3E%3CCODE%3E--public-ip-address-dns-name%20devtoappvm%3C%2FCODE%3E%3C%2FSTRONG%3E%3CBR%20%2F%3EI%20want%20a%20fully%20qualified%20domain%20name%20available%20with%20the%20hostname%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CCODE%3Edevtoappvm%3C%2FCODE%3E%3CBR%20%2F%3E%3CSTRONG%3E%3CCODE%3E--image%20UbuntuLTS%3C%2FCODE%3E%3C%2FSTRONG%3E%3CBR%20%2F%3EI%20want%20to%20use%20the%20Linux%20Ubuntu%20Long%20Term%20Support%20Image%3CBR%20%2F%3E%3CSTRONG%3E%3CCODE%3E--admin-username%20azureuser%3C%2FCODE%3E%3C%2FSTRONG%3E%3CBR%20%2F%3EI%20want%20my%20username%20for%20the%20server%20to%20be%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CCODE%3Eazureuser%3C%2FCODE%3E%3CBR%20%2F%3E%3CSTRONG%3E%3CCODE%3E--generate-ssh-keys%3C%2FCODE%3E%3C%2FSTRONG%3E%3CBR%20%2F%3EI%20want%20Azure%20to%20create%20a%20new%20ssh%20key%20pair%20for%20the%20new%20VM.%20The%20key%20files%20are%20stored%20in%20the%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CCODE%3E~%2F.ssh%3C%2FCODE%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Edirectory%20unless%20specified%20otherwise%20with%20the%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CCODE%3E--ssh-dest-key-path%3C%2FCODE%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Eoption.%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%20vm%20create%20--resource-group%20devtoapp%20--name%20devtoappvm%20--public-ip-address-dns-name%20devtoappvm%20--image%20UbuntuLTS%20--admin-username%20azureuser%20--generate-ssh-keys%0A%3C%2FCODE%3E%3C%2FPRE%3E%0A%3C%2FDIV%3E%0A%3CP%3EI%20will%20get%20the%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CCODE%3E-%20Running%20..%3C%2FCODE%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Eresponse%20from%20Azure%20Resource%20Manager%20until%20the%20new%20VM%20is%20created.%20When%20the%20VM%20is%20ready%2C%20the%20resource%20manager%20will%20output%20a%20JSON%20document%20with%20details%20associated%20with%20the%20VM.%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%3E%7B%0A%20%20%22fqdns%22%3A%20%22devtoappvm.eastus.cloudapp.azure.com%22%2C%0A%20%20%22id%22%3A%20%22%2Fsubscriptions%2Ffakefakefake-54cc-0000-a58b-87afakefakefake7ad%2FresourceGroups%2Fdevtoapp%2Fproviders%2FMicrosoft.Compute%2FvirtualMachines%2Fdevtoappvm%22%2C%0A%20%20%22location%22%3A%20%22eastus%22%2C%0A%20%20%22macAddress%22%3A%20%2200-0D-3A-15-0A-5C%22%2C%0A%20%20%22powerState%22%3A%20%22VM%20running%22%2C%0A%20%20%22privateIpAddress%22%3A%20%2210.0.0.4%22%2C%0A%20%20%22publicIpAddress%22%3A%20%2213.90.240.117%22%2C%0A%20%20%22resourceGroup%22%3A%20%22devtoapp%22%2C%0A%20%20%22zones%22%3A%20%22%22%0A%7D%0A%3C%2FCODE%3E%3C%2FPRE%3E%0A%3C%2FDIV%3E%0A%3CP%3ELooks%20like%20the%20server%20is%20up%2C%20I'll%20ssh%20in%20and%20take%20a%20look!%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--LYYYX1Lv--%2Fc_limit%252Cf_auto%252Cfl_progressive%252Cq_auto%252Cw_880%2Fhttps%3A%2F%2Fthepracticaldev.s3.amazonaws.com%2Fi%2Fa1f2a9jaeaugxf3vtow2.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--LYYYX1Lv--%2Fc_limit%252Cf_auto%252Cfl_progressive%252Cq_auto%252Cw_880%2Fhttps%3A%2F%2Fthepracticaldev.s3.amazonaws.com%2Fi%2Fa1f2a9jaeaugxf3vtow2.png%22%20border%3D%220%22%20alt%3D%22%22%20%2F%3E%3C%2FA%3E%3C%2FP%3E%0A%3CP%3EGreat%2C%20time%20to%20add%20a%20new%20network%20rule%20to%20the%20server.%3C%2FP%3E%0A%3CH3%20id%3D%22toc-hId--23696202%22%20id%3D%22toc-hId--23696202%22%3E%3CA%20class%3D%22anchor%22%20href%3D%22https%3A%2F%2Fdev.to%2Fazure%2Fazure-cloud-shell-tips-for-sysadmins-part-iii-using-azure-cli-for-server-details-9dd%23create-network-rule%22%20target%3D%22_blank%22%20rel%3D%22noopener%20nofollow%20noopener%20noreferrer%20noopener%20noreferrer%22%20name%3D%22create-network-rule%22%3E%3C%2FA%3ECreate%20Network%20Rule%3C%2FH3%3E%0A%3CP%3ENow%20that%20I%20have%20this%20new%20server%2C%20I'd%20like%20to%20add%20network%20rules%20so%20that%20I%20am%20able%20to%20access%20ports%2080%2F443%20which%20are%20standard%20for%20web%20traffic.%20Let's%20take%20a%20look%20at%20one%20of%20the%20rules%20I'll%20be%20using%20and%20break%20it%20down%20on%20what%20exactly%20is%20happening%3A%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSTRONG%3E%3CCODE%3Eaz%20vm%20open-port%3C%2FCODE%3E%3C%2FSTRONG%3E%3CBR%20%2F%3EI%20want%20to%20open%20a%20port%20to%20a%20VM%3CBR%20%2F%3E%3CSTRONG%3E%3CCODE%3E--port%2080%3C%2FCODE%3E%3C%2FSTRONG%3E%3CBR%20%2F%3EName%20the%20rule%20%22port%2080%22%20and%20open%20port%2080%20on%20the%20server%3CBR%20%2F%3E%3CSTRONG%3E%3CCODE%3E--priority%20101%3C%2FCODE%3E%3C%2FSTRONG%3E%3CBR%20%2F%3ERule%20priority%20101%2C%20between%20100%20(highest%20priority)%20and%204096%20(lowest%20priority).%3CBR%20%2F%3E%3CSTRONG%3E%3CCODE%3E--resource-group%20devtoapp%3C%2FCODE%3E%3C%2FSTRONG%3E%3CBR%20%2F%3EThe%20resource%20group%20the%20server%20lives%20in.%3CBR%20%2F%3E%3CSTRONG%3E%3CCODE%3E--name%20devtoappvm%3C%2FCODE%3E%3C%2FSTRONG%3E%3CBR%20%2F%3EThe%20name%20of%20the%20server.%3C%2FP%3E%0A%3CP%3EI'll%20run%20the%20command%3C%2FP%3E%0A%3CDIV%20class%3D%22highlight%22%3E%0A%3CPRE%20class%3D%22highlight%20plaintext%22%3E%3CCODE%3Eaz%20vm%20open-port%20--port%2080%20--priority%20101%20--resource-group%20devtoapp%20--name%20devtoappvm%0A%3C%2FCODE%3E%3C%2FPRE%3E%0A%3C%2FDIV%3E%0A%3CP%3Eand%20get%20the%20output%20from%20Azure%20Resource%20Manager%3A%3C%2FP%3E%0A%3CDIV%20class%3D%22highlight%22%3E%0A%3CPRE%20class%3D%22highlight%20plaintext%22%3E%3CCODE%3E%20%7B%0A%20%20%20%20%20%20%22access%22%3A%20%22Allow%22%2C%0A%20%20%20%20%20%20%22description%22%3A%20null%2C%0A%20%20%20%20%20%20%22destinationAddressPrefix%22%3A%20%22*%22%2C%0A%20%20%20%20%20%20%22destinationAddressPrefixes%22%3A%20%5B%5D%2C%0A%20%20%20%20%20%20%22destinationApplicationSecurityGroups%22%3A%20null%2C%0A%20%20%20%20%20%20%22destinationPortRange%22%3A%20%2280%22%2C%0A%20%20%20%20%20%20%22destinationPortRanges%22%3A%20%5B%5D%2C%0A%20%20%20%20%20%20%22direction%22%3A%20%22Inbound%22%2C%0A%20%20%20%20%20%20%22etag%22%3A%20%22W%2F%5C%22dcb63769-502e-4e8b-ad93-b909cff97e9e%5C%22%22%2C%0A%20%20%20%20%20%20%22id%22%3A%20%22%2Fsubscriptions%2Ffakefakefake-54cc-0000-a58b-87afakefakefake7ad%2FresourceGroups%2Fdevtoapp%2Fproviders%2FMicrosoft.Network%2FnetworkSecurityGroups%2FdevtoappvmNSG%2FsecurityRules%2Fopen-port-80%22%2C%0A%20%20%20%20%20%20%22name%22%3A%20%22open-port-80%22%2C%0A%20%20%20%20%20%20%22priority%22%3A%20101%2C%0A%20%20%20%20%20%20%22protocol%22%3A%20%22*%22%2C%0A%20%20%20%20%20%20%22provisioningState%22%3A%20%22Succeeded%22%2C%0A%20%20%20%20%20%20%22resourceGroup%22%3A%20%22devtoapp%22%2C%0A%20%20%20%20%20%20%22sourceAddressPrefix%22%3A%20%22*%22%2C%0A%20%20%20%20%20%20%22sourceAddressPrefixes%22%3A%20%5B%5D%2C%0A%20%20%20%20%20%20%22sourceApplicationSecurityGroups%22%3A%20null%2C%0A%20%20%20%20%20%20%22sourcePortRange%22%3A%20%22*%22%2C%0A%20%20%20%20%20%20%22sourcePortRanges%22%3A%20%5B%5D%2C%0A%20%20%20%20%20%20%22type%22%3A%20%22Microsoft.Network%2FnetworkSecurityGroups%2FsecurityRules%22%0A%20%20%20%20%7D%0A%3C%2FCODE%3E%3C%2FPRE%3E%0A%3C%2FDIV%3E%0A%3CP%3EI%20will%20run%20the%20the%20following%20rule%20with%20the%20priority%20incremented%20to%20102%20and%20a%20rule%20for%20port%20443%3A%3C%2FP%3E%0A%3CDIV%20class%3D%22highlight%22%3E%0A%3CPRE%20class%3D%22highlight%20plaintext%22%3E%3CCODE%3Eaz%20vm%20open-port%20--port%20443%20--priority%20102%20--resource-group%20devtoapp%20--name%20devtoappvm%0A%3C%2FCODE%3E%3C%2FPRE%3E%0A%3C%2FDIV%3E%0A%3CP%3ENow%20I%20have%20a%20server%20that%20I%20have%20ready%20for%20me%20to%20begin%20installing%20any%20specific%20configuration%20management%20agent%20I%20may%20need%20or%20to%20perform%20a%20manual%20install%20of%20an%20application.%3C%2FP%3E%0A%3CH3%20id%3D%22toc-hId-1719114133%22%20id%3D%22toc-hId-1719114133%22%3E%3CA%20class%3D%22anchor%22%20href%3D%22https%3A%2F%2Fdev.to%2Fazure%2Fazure-cloud-shell-tips-for-sysadmins-part-iii-using-azure-cli-for-server-details-9dd%23wrapping-up%22%20target%3D%22_blank%22%20rel%3D%22noopener%20nofollow%20noopener%20noreferrer%20noopener%20noreferrer%22%20name%3D%22wrapping-up%22%3E%3C%2FA%3EWrapping%20Up%3C%2FH3%3E%0A%3CP%3EI've%20been%20putting%20together%20these%20starter%20tips%20for%20manual%20work%20to%20show%20the%20baby%20steps%20one%20may%20need%20to%20take%20to%20begin%20working%20with%20Azure.%20I%20will%20continue%20to%20work%20through%20these%20%22getting%20started%22%20tasks%20to%20help%20users%20who%20may%20be%20still%20working%20to%20understand%20what's%20the%20big%20difference%20between%20their%20datacenter%20and%20the%20cloud.%20I%20will%20continue%20to%20find%20you%20new%20ways%20to%20do%20work%20you%20may%20already%20be%20doing!%20Always%20feel%20free%20to%20reach%20out%20to%20me%20if%20you%20need%20more%20info%20or%20just%20want%20to%20say%20thanks%20on%20twitter%2C%20you%20can%20find%20me%20there%20as%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%3E%40jaydestro%3C%2FA%3E.%20Be%20sure%20also%20to%20check%20out%20my%20podcast%2C%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CA%20href%3D%22https%3A%2F%2Foncallnightmares.podomatic.com%2F%22%20target%3D%22_blank%22%20rel%3D%22noopener%20nofollow%20noopener%20noreferrer%20noopener%20noreferrer%22%3EOn-Call%20Nightmares%3C%2FA%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Eand%20hear%20stories%20from%20other%20Ops%20professionals%20who've%20spent%20time%20on-call%20in%20tech!%3C%2FP%3E%0A%3C%2FDIV%3E%0A%3CDIV%20class%3D%22article-collection-wrapper%20article-collection-wrapper-bottom%22%3E%26nbsp%3B%3C%2FDIV%3E%3C%2FLINGO-BODY%3E%3CLINGO-TEASER%20id%3D%22lingo-teaser-734969%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-II-Using-the-Cloud%2Fba-p%2F734965%22%20target%3D%22_blank%22%20rel%3D%22noopener%22%3EAzure%20Cloud%20Shell%20Tips%20for%20SysAdmins%20Part%20II%20-%20Using%20the%20Cloud%20Shell%20tools%20to%20Migrate%3C%2FA%3E%2C%20I%20use%20some%20of%20the%20tools%20that%20are%20part%20of%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.%20This%20time%2C%20I'll%20give%20you%20some%20quick%20tips%20on%20working%20with%20the%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fazure%2Fazure-resource-manager%2Fresource-group-overview%2F%3FWT.mc_id%3Dhttps%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%20Resource%20Manager%3C%2FA%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Efor%20information%20and%20to%20modify%20a%20newly%20created%20VM.%20I%20will%20be%20using%20the%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fcli%2Fazure%2Fget-started-with-azure-cli%3FWT.mc_id%3Dhttps%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%20CLI%3C%2FA%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Etool%20that's%20ready%20in%20Azure%20Cloud%20Shell.%3C%2FP%3E%0A%3CH3%20id%3D%22toc-hId--833042828%22%3E%3CA%20class%3D%22anchor%22%20href%3D%22https%3A%2F%2Fdev.to%2Fazure%2Fazure-cloud-shell-tips-for-sysadmins-part-iii-using-azure-cli-for-server-details-9dd%23first-steps%22%20name%3D%22first-steps%22%20rel%3D%22nofollow%20noopener%20noreferrer%20noopener%20noreferrer%22%20target%3D%22_blank%22%3E%3C%2FA%3E%3C%2FH3%3E%3C%2FLINGO-TEASER%3E%3CLINGO-LABS%20id%3D%22lingo-labs-734969%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.%20Ops%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 Part II - Using the Cloud Shell tools to Migrate, I use some of the tools that are part of the Azure Cloud Shell for bash. This time, I'll give you some quick tips on working with the Azure Resource Manager for information and to modify a newly created VM. I will be using the Azure CLI tool that's ready in Azure Cloud Shell.

First Steps

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. You can install the Azure CLI locally by following the instructions for your operating system.

Using Azure CLI

Let's run through a series of tasks you may need to do to create a new Linux server using Azure CLI.

Create a resource group.

I like to think of a resource group as a big box where you can put all of your Azure resources. When I am finished with the box, I can throw it away into a dumpster and move on. I won't have to spend time deleting each individual resource when I am finished.

 

 

Creating a resource group requires you provide at a minimum two pieces of information required to create the group.

  • Name - Literally what you want the resource group's name to be
  • Location - This is where metadata about your resource group will be stored. This could be important for those who may require all of your infrastructure's data be stored in a specific country due to compliance.

Another optional setting is Subscription that permits the user to state which billing subscription the resource group will belong to.

 

To create a resource group named "devtoapp" in the East US region of Azure, I will execute the following command:

az group create --location eastus --name devtoapp

The Azure Resource Manager will then create your group and provide you with a JSON output of what was created:

{
  "id": "/subscriptions/fakefakefake-54cc-0000-a58b-87afakefakefake7ad/resourceGroups/devtoapp",
  "location": "eastus",
  "managedBy": null,
  "name": "devtoapp",
  "properties": {
    "provisioningState": "Succeeded"
  },
  "tags": null,
  "type": null
}

Looks like I forgot to set a tag to say this is my "dev" environment - let's update that:

az group update --name devtoapp --set tags.Details='{"Environment":"dev"}'

I've told Azure Resource Manager to update the metadata associated with my group to include a tag about my environment.

{
  "id": "/subscriptions/fakefakefake-54cc-0000-a58b-87afakefakefake7ad/resourceGroups/devtoapp",
  "location": "eastus",
  "managedBy": null,
  "name": "devtoapp",
  "properties": {
    "provisioningState": "Succeeded"
  },
  "tags": {
    "Details": "{'Environment': 'dev'}"
  },
  "type": null
}

Done! Let's put some resources in this group!

Create a VM

In my last blog, I did all the work for the reader by providing you with a script that handled all the creation of the VM. This time around, I'd like to show the command and explain what's being passed to the Azure Resource Manager.

 

Before I run this, I want to explain what I am doing by executing the command in my Cloud Shell.

az vm create
I want to create a VM
--resource-group devtoapp
I want to put this new VM in the devtoapp resource group
--name devtoappvm
The name of my new VM should be devtoappvm
--public-ip-address-dns-name devtoappvm
I want a fully qualified domain name available with the hostname devtoappvm
--image UbuntuLTS
I want to use the Linux Ubuntu Long Term Support Image
--admin-username azureuser
I want my username for the server to be azureuser
--generate-ssh-keys
I want Azure to create a new ssh key pair for the new VM. The key files are stored in the ~/.ssh directory unless specified otherwise with the --ssh-dest-key-path option.

 

az vm create --resource-group devtoapp --name devtoappvm --public-ip-address-dns-name devtoappvm --image UbuntuLTS --admin-username azureuser --generate-ssh-keys

I will get the - Running .. response from Azure Resource Manager until the new VM is created. When the VM is ready, the resource manager will output a JSON document with details associated with the VM.

 

{
  "fqdns": "devtoappvm.eastus.cloudapp.azure.com",
  "id": "/subscriptions/fakefakefake-54cc-0000-a58b-87afakefakefake7ad/resourceGroups/devtoapp/providers/Microsoft.Compute/virtualMachines/devtoappvm",
  "location": "eastus",
  "macAddress": "00-0D-3A-15-0A-5C",
  "powerState": "VM running",
  "privateIpAddress": "10.0.0.4",
  "publicIpAddress": "13.90.240.117",
  "resourceGroup": "devtoapp",
  "zones": ""
}

Looks like the server is up, I'll ssh in and take a look!

 

Great, time to add a new network rule to the server.

Create Network Rule

Now that I have this new server, I'd like to add network rules so that I am able to access ports 80/443 which are standard for web traffic. Let's take a look at one of the rules I'll be using and break it down on what exactly is happening:

 

az vm open-port
I want to open a port to a VM
--port 80
Name the rule "port 80" and open port 80 on the server
--priority 101
Rule priority 101, between 100 (highest priority) and 4096 (lowest priority).
--resource-group devtoapp
The resource group the server lives in.
--name devtoappvm
The name of the server.

I'll run the command

az vm open-port --port 80 --priority 101 --resource-group devtoapp --name devtoappvm

and get the output from Azure Resource Manager:

 {
      "access": "Allow",
      "description": null,
      "destinationAddressPrefix": "*",
      "destinationAddressPrefixes": [],
      "destinationApplicationSecurityGroups": null,
      "destinationPortRange": "80",
      "destinationPortRanges": [],
      "direction": "Inbound",
      "etag": "W/\"dcb63769-502e-4e8b-ad93-b909cff97e9e\"",
      "id": "/subscriptions/fakefakefake-54cc-0000-a58b-87afakefakefake7ad/resourceGroups/devtoapp/providers/Microsoft.Network/networkSecurityGroups/devtoappvmNSG/securityRules/open-port-80",
      "name": "open-port-80",
      "priority": 101,
      "protocol": "*",
      "provisioningState": "Succeeded",
      "resourceGroup": "devtoapp",
      "sourceAddressPrefix": "*",
      "sourceAddressPrefixes": [],
      "sourceApplicationSecurityGroups": null,
      "sourcePortRange": "*",
      "sourcePortRanges": [],
      "type": "Microsoft.Network/networkSecurityGroups/securityRules"
    }

I will run the the following rule with the priority incremented to 102 and a rule for port 443:

az vm open-port --port 443 --priority 102 --resource-group devtoapp --name devtoappvm

Now I have a server that I have ready for me to begin installing any specific configuration management agent I may need or to perform a manual install of an application.

Wrapping Up

I've been putting together these starter tips for manual work to show the baby steps one may need to take to begin working with Azure. I will continue to work through these "getting started" tasks to help users who may be still working to understand what's the big difference between their datacenter and the cloud. I will continue to find you new ways to do work you may already be doing! Always feel free to reach out to me if you need more info or just want to say thanks on twitter, you can find me there as @jaydestro. Be sure also to check out my podcast, On-Call Nightmares and hear stories from other Ops professionals who've spent time on-call in tech!