Home
%3CLINGO-SUB%20id%3D%22lingo-sub-851055%22%20slang%3D%22en-US%22%3ERe%3A%20Tags%20-%20An%20easy%20way%20to%20gain%20insight%20into%20your%20cloud%20resources%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-851055%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Fsaffronferdows.ir%2F%22%20target%3D%22_blank%22%20rel%3D%22nofollow%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%22%3Ehttps%3A%2F%2Fsaffronferdows.ir%2F%3C%2FA%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-846412%22%20slang%3D%22en-US%22%3ETags%20-%20An%20easy%20way%20to%20gain%20insight%20into%20your%20cloud%20resources%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-846412%22%20slang%3D%22en-US%22%3E%3CP%3EKeeping%20your%20resources%20organized%2C%20whether%20in%20the%20cloud%20or%20on-premises%2C%20is%20a%20critical%20part%20of%20managing%20your%20environment.%20It%20allows%20for%20you%20to%20have%20control%20and%20visibility%20into%20your%20when%20multiple%20teams%20are%20working%20and%20doing%20their%20thing%20to%20get%20their%20jobs%20done.%20Without%20any%20type%20of%20organization%2C%20it%20makes%20enforcing%20standards%2C%20polices%20and%20maintaining%20control%20over%20the%20environment%20very%20difficult.%20There%20are%20different%20ways%20to%20help%20with%20organization%20in%20Azure%2C%20such%20as%20Management%20groups%2C%20Resource%20groups%2C%20Roles%2C%20Naming%20conventions%20and%20Tags.%20This%20blog%20post%20will%20focus%20on%20using%20tags%20to%20help%20you%20stay%20organized%20and%20gain%20visibility%20into%20your%20Azure%20environment.%20Once%20tagged%20you%20can%20easily%20query%20and%20analyze%20your%20resources%20and%20usage%20data%20to%20gain%20insights%20that%20can%20enable%20better%20cost%20management%20and%20allocation%20throughout%20your%20Azure%20environment.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSTRONG%3EWhat%20are%20Tags%3F%3C%2FSTRONG%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3ETags%20are%20user-defined%20key%2Fvalue%20pairs%20which%20can%20be%20placed%20directly%20on%20a%20resource%20or%20resource%20group.%20They%20can%20be%20added%20to%20resources%20and%2For%20resource%20groups%20through%20the%20portal%2C%20PowerShell%2C%20Azure%20cli%20and%20ARM%20templates.%20Please%20note%20not%20all%20resources%20in%20Azure%20currently%20support%20tags%20so%20check%20this%20list%20%2C%20see%20%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fazure%2Fazure-resource-manager%2Ftag-support%3FWT.mc_id%3Ditopstalk-blog-phschmit%22%20target%3D%22_self%22%20rel%3D%22noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%22%3ETag%20support%20for%20Azure%20resources%3C%2FA%3E%2C%20to%20determine%20if%20you%20can%20apply%20a%20tag%20on%20a%20particular%20resource%20type.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CUL%3E%0A%3CLI%3EAzure%20currently%20supports%20up%20to%2050%20tags%20per%20resource%20and%20resource%20group%20and%20each%20tag%20name%20is%20limited%20to%20512%20characters%20and%20each%20tag%20value%20is%20limited%20to%20256.%3C%2FLI%3E%0A%3CLI%3EAzure%20Storage%20accounts%2C%20the%20tag%20name%20is%20limited%20to%20128%20characters%2C%20and%20the%20tag%20value%20is%20limited%20to%20256%20characters.%3C%2FLI%3E%0A%3CLI%3EEach%20resource%20or%20resource%20group%20can%20have%20a%20maximum%20of%2050%20tag%20name%2Fvalue%20pairs.%20Currently%2C%20storage%20accounts%20only%20support%2015%20tags%2C%20but%20that%20limit%20will%20be%20raised%20to%2050%20in%20a%20future%20release.%20If%20you%20need%20to%20apply%20more%20tags%20than%20the%20maximum%20allowed%20number%2C%20use%20a%20JSON%20string%20for%20the%20tag%20value.%20The%20JSON%20string%20can%20contain%20many%20values%20that%20are%20applied%20to%20a%20single%20tag%20name.%20A%20resource%20group%20can%20contain%20many%20resources%20that%20each%20have%2050%20tag%20name%2Fvalue%20pairs.%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3CUL%3E%0A%3CLI%3ETags%20applied%20to%20the%20resource%20group%20are%20not%20inherited%20by%20the%20resources%20in%20that%20resource%20group.%3C%2FLI%3E%0A%3CLI%3ETags%20can't%20be%20applied%20to%20classic%20resources%20such%20as%20Cloud%20Services.%3C%2FLI%3E%0A%3CLI%3ETag%20names%20can't%20contain%20these%20characters%3A%20%26lt%3B%2C%20%26gt%3B%2C%20%25%2C%20%26amp%3B%2C%20%5C%2C%20%3F%2C%20%2F%3C%2FLI%3E%0A%3CLI%3EGeneralized%20VMs%20don't%20support%20tags.%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSTRONG%3EHow%20could%20I%20use%20tags%20in%20my%20Azure%20environment%3F%3C%2FSTRONG%3E%3C%2FP%3E%0A%3CP%3EThere%20are%20several%20ways%20you%20could%20implement%20a%20tagging%20system%20into%20your%20environment.%20The%20first%20use%20case%20that%20comes%20to%20mind%20is%20always%20billing%20resources%20but%20tagging%20is%20great%20from%20an%20operational%20procedures.%20Below%20are%20some%20examples%3A%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CUL%3E%0A%3CLI%3ETags%20can%20used%20to%20group%20resources%20together%20for%20billing.%20You%20can%20tag%20resources%20such%20as%20VMs%2C%20runtime%20environment%20or%20even%20the%20whole%20resource%20group%20by%20cost%20center.%20Then%20the%20data%20can%20viewed%2Fdownloaded%20from%20Azure%20Account%20center.%3C%2FLI%3E%0A%3CLI%3ETagging%20resources%20can%20also%20help%20in%20monitoring%20to%20track%20down%20impacted%20resources.%20Monitoring%20systems%20could%20include%20tag%20data%20with%20alerts%2C%20giving%20you%20the%20ability%20to%20know%20exactly%20who%20is%20impacted.%3C%2FLI%3E%0A%3CLI%3EResources%20can%20be%20tagged%20by%20Creation%20type%2C%20such%20as%20migrated%20systems%20or%20systems%20native%20to%20azure.%20This%20method%20can%20help%20with%20categorizing%20which%20systems%20was%20%22lift%20and%20Shift%22%20vs%20being%20created%20in%20Azure%20natively.%3C%2FLI%3E%0A%3CLI%3ETags%20can%20be%20used%20identify%20Production%2C%20development%20and%20QA%20systems%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSTRONG%3EHow%20to%20apply%20tags%3C%2FSTRONG%3E%3C%2FP%3E%0A%3CP%3ETags%20can%20be%20applied%20to%20a%20resource%20through%20several%20ways.%3C%2FP%3E%0A%3CUL%3E%0A%3CLI%3E%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fazure%2Fazure-resource-manager%2Fresource-group-using-tags%3FWT.mc_id%3Ditopstalk-blog-phschmit%23portal%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%22%3EAzure%20Portal%20%3C%2FA%3E%3C%2FLI%3E%0A%3CLI%3E%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fazure%2Fazure-resource-manager%2Fresource-group-using-tags%3FWT.mc_id%3Ditopstalk-blog-phschmit%23powershell%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%22%3EAzure%20Powershell%3C%2FA%3E%3C%2FLI%3E%0A%3CLI%3E%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fazure%2Fazure-resource-manager%2Fresource-group-using-tags%3FWT.mc_id%3Ditopstalk-blog-phschmit%23azure-cli%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%22%3EAzure%20cli%3C%2FA%3E%3C%2FLI%3E%0A%3CLI%3E%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fazure%2Fazure-resource-manager%2Fresource-group-using-tags%3FWT.mc_id%3Ditopstalk-blog-phschmit%23templates%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%22%3EAzure%20Arm%20templates%3C%2FA%3E%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3CP%3EApplying%20tags%20manually%20can%20cause%20some%20disorganization%20as%20well%20when%20you%20have%20multiple%20teams%20working%20all%20at%20once%20so%20using%20policy%20to%20enforce%20tags%20will%20help%20ensure%20consistency.%20There%20are%20several%20built%20in%20Azure%20Policies%20to%20enforce%20tags%3A%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fazure%2Fazure-resource-manager%2Fresource-group-using-tags%3FWT.mc_id%3Ditopstalk-blog-phschmit%23policies%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%22%3EAzure%20policy%20to%20enforce%20and%20apply%20tag%3C%2FA%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CTABLE%3E%0A%3CTBODY%3E%0A%3CTR%3E%0A%3CTD%3E%3CP%3EApply%20tag%20and%20its%20default%20value%3C%2FP%3E%0A%3C%2FTD%3E%0A%3CTD%3E%3CP%3EAppends%20a%20specified%20tag%20name%20and%20value%2C%20if%20that%20tag%20is%20not%20provided.%20You%20specify%20the%20tag%20name%20and%20value%20to%20apply.%3C%2FP%3E%0A%3C%2FTD%3E%0A%3C%2FTR%3E%0A%3CTR%3E%0A%3CTD%3E%3CP%3EBilling%20Tags%20Policy%20Initiative%3C%2FP%3E%0A%3C%2FTD%3E%0A%3CTD%3E%3CP%3ERequires%20specified%20tag%20values%20for%20cost%20center%20and%20product%20name.%20Uses%20built-in%20policies%20to%20apply%20and%20enforce%20required%20tags.%20You%20specify%20the%20required%20values%20for%20the%20tags.%3C%2FP%3E%0A%3C%2FTD%3E%0A%3C%2FTR%3E%0A%3CTR%3E%0A%3CTD%3E%3CP%3EEnforce%20tag%20and%20its%20value%3C%2FP%3E%0A%3C%2FTD%3E%0A%3CTD%3E%3CP%3ERequires%20a%20specified%20tag%20name%20and%20value.%20You%20specify%20the%20tag%20name%20and%20value%20to%20enforce.%3C%2FP%3E%0A%3C%2FTD%3E%0A%3C%2FTR%3E%0A%3CTR%3E%0A%3CTD%3E%3CP%3EEnforce%20tag%20and%20its%20value%20on%20resource%20groups%3C%2FP%3E%0A%3C%2FTD%3E%0A%3CTD%3E%3CP%3ERequires%20a%20tag%20and%20value%20on%20a%20resource%20group.%20You%20specify%20the%20required%20tag%20name%20and%20value.%3C%2FP%3E%0A%3C%2FTD%3E%0A%3C%2FTR%3E%0A%3C%2FTBODY%3E%0A%3C%2FTABLE%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSTRONG%3EHow%20to%20query%20your%20tags%3C%2FSTRONG%3E%3C%2FP%3E%0A%3CP%3ENow%20that%20you've%20applied%20you've%20tags%20you%20can%20look%20up%20and%20query%20your%20resources.%20You%20can%20filter%20you%20resources%20via%20tags%20through%20the%20%22All%20Resources%22%20view%20in%20the%20Azure%20Portal%20or%20through%20%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fazure%2Fgovernance%2Fresource-graph%2Fsamples%2Fstarter%3FWT.mc_id%3Ditopstalk-blog-phschmit%23list-resources-with-a-specific-tag-value%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%22%3EAzure%20Resource%20Graph%3C%2FA%3E.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EAn%20example%3A%3C%2FP%3E%0A%3CP%3EUsing%20Azure%20Resource%20Graph%20Explorer%20%2C%20if%20I%20want%20to%20know%20which%20VMs%20in%20my%20environment%20that%20have%20been%20migrated%20into%20Azure%20I%20would%20query%20for%20VMs%20that%20use%20the%20CreationType%20tag.%20When%20the%20query%20is%20completed%20you%20can%20pin%20your%20results%20to%20the%20dashboard.%20The%20following%20query%20is%20looking%20for%20VMs%20that%20are%20tagged%20migrated%20and%20grouped%20by%20Linux%20and%20Windows%20server.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EKusto%20query%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CPRE%20class%3D%22lia-code-sample%20language-markup%22%3E%3CCODE%3Ewhere%20type%20%3D%3D%20%22microsoft.compute%2Fvirtualmachines%22%20%0A%7C%20extend%20OSType%20%3D%20iff(type%20%3D%3D%20%22microsoft.compute%2Fvirtualmachines%22%2C%20tostring(properties.storageProfile.osDisk.osType)%2Ctostring(properties.storageProfile.operatingSystemDisk.operatingSystem))%20%0A%7Cwhere%20tags.Creationtype%3D~'migrated'%0A%7C%20summarize%20VMCount%3Dcount()%20by%20OSType%0A%7C%20order%20by%20VMCount%20desc%0A%7Cextend%20%5B'Count%20(Virtual%20Machines)'%5D%3DVMCount%0A%7C%20project%20OSType%2C%20%5B'Count%20(Virtual%20Machines)'%5D%0A%3C%2FCODE%3E%3C%2FPRE%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3BRunning%20the%20query%20in%20Azure%20Resource%20Graph%20Explorer%3A%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20style%3D%22width%3A%20999px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F130924i91D6FA2B0F1F56C9%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20alt%3D%22queryA.png%22%20title%3D%22queryA.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3EUsing%20the%20chart%20view%20of%20the%20query%20you%20can%20also%20pin%20to%20your%20dashboard.%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20style%3D%22width%3A%20964px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F130925i590E743520F0D46B%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20alt%3D%22queryB.png%22%20title%3D%22queryB.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%20style%3D%22margin%3A%200in%3B%20font-family%3A%20Calibri%3B%20font-size%3A%2014.0pt%3B%22%3E%3CSPAN%20style%3D%22font-weight%3A%20bold%3B%22%3ETAG%20ALL%20THINGS!!%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%20style%3D%22margin%3A%200in%3B%20font-family%3A%20Calibri%3B%20font-size%3A%2011.0pt%3B%22%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%20style%3D%22margin%3A%200in%3B%20font-family%3A%20Calibri%3B%20font-size%3A%2011.0pt%3B%22%3EAs%20you%20can%20see%20from%20the%20sample%20above%20using%20tags%20helps%20you%20stay%20organized%20and%20gives%20you%20visibility%20into%20your%20Azure%20environment%20for%20better%20control%20and%20management.%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-TEASER%20id%3D%22lingo-teaser-846412%22%20slang%3D%22en-US%22%3E%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20style%3D%22width%3A%20400px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F130928i18BE7D7C24AFF6A5%2Fimage-size%2Fmedium%3Fv%3D1.0%26amp%3Bpx%3D400%22%20alt%3D%22tags.PNG%22%20title%3D%22tags.PNG%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3EKeeping%20your%20resources%20organized%2C%20whether%20in%20the%20cloud%20or%20on-premises%2C%20is%20a%20critical%20part%20of%20managing%20your%20environment.%26nbsp%3BThere%20are%20different%20ways%20to%20help%20with%20organization%20in%20Azure%20such%20as%20using%20tags.%26nbsp%3B%20Once%20tagged%20you%20can%20easily%20query%26nbsp%3B%20your%20resources%20and%20usage%20data%20to%20gain%20insights%20that%20can%20enable%20better%20cost%20management%20and%20allocation%20throughout%20your%20Azure%20environment.%3C%2FP%3E%3C%2FLINGO-TEASER%3E%3CLINGO-LABS%20id%3D%22lingo-labs-846412%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EAzure%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EGovernance%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3ESecurity%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EWindows%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EWindows%20Server%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-861940%22%20slang%3D%22en-US%22%3ERe%3A%20Tags%20-%20An%20easy%20way%20to%20gain%20insight%20into%20your%20cloud%20resources%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-861940%22%20slang%3D%22en-US%22%3E%3CP%3EHey%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F175964%22%20target%3D%22_blank%22%3E%40Phoummala%20Schmitt%3C%2FA%3E%26nbsp%3B-%20Great%20post.%20As%20part%20of%20Cloud%20governance%2C%20tagging%20is%20essential.%20Speaking%20of%20governance%2C%20you%20didn't%20mention%20Azure%20Blueprints%20as%20another%20mechanism%20to%20for%20applying%20tags%2C%20although%20I%20guess%20blueprints%20use%20the%20policies%20which%20you%20speak%20about%20in%20this%20post.%20Otherwise%20great%20advise.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E

Keeping your resources organized, whether in the cloud or on-premises, is a critical part of managing your environment. It allows for you to have control and visibility into your when multiple teams are working and doing their thing to get their jobs done. Without any type of organization, it makes enforcing standards, polices and maintaining control over the environment very difficult. There are different ways to help with organization in Azure, such as Management groups, Resource groups, Roles, Naming conventions and Tags. This blog post will focus on using tags to help you stay organized and gain visibility into your Azure environment. Once tagged you can easily query and analyze your resources and usage data to gain insights that can enable better cost management and allocation throughout your Azure environment.

 

What are Tags?

 

Tags are user-defined key/value pairs which can be placed directly on a resource or resource group. They can be added to resources and/or resource groups through the portal, PowerShell, Azure cli and ARM templates. Please note not all resources in Azure currently support tags so check this list , see Tag support for Azure resources, to determine if you can apply a tag on a particular resource type.

 

  • Azure currently supports up to 50 tags per resource and resource group and each tag name is limited to 512 characters and each tag value is limited to 256.
  • Azure Storage accounts, the tag name is limited to 128 characters, and the tag value is limited to 256 characters.
  • Each resource or resource group can have a maximum of 50 tag name/value pairs. Currently, storage accounts only support 15 tags, but that limit will be raised to 50 in a future release. If you need to apply more tags than the maximum allowed number, use a JSON string for the tag value. The JSON string can contain many values that are applied to a single tag name. A resource group can contain many resources that each have 50 tag name/value pairs.
  • Tags applied to the resource group are not inherited by the resources in that resource group.
  • Tags can't be applied to classic resources such as Cloud Services.
  • Tag names can't contain these characters: <, >, %, &, \, ?, /
  • Generalized VMs don't support tags.

 

How could I use tags in my Azure environment?

There are several ways you could implement a tagging system into your environment. The first use case that comes to mind is always billing resources but tagging is great from an operational procedures. Below are some examples:

 

  • Tags can used to group resources together for billing. You can tag resources such as VMs, runtime environment or even the whole resource group by cost center. Then the data can viewed/downloaded from Azure Account center.
  • Tagging resources can also help in monitoring to track down impacted resources. Monitoring systems could include tag data with alerts, giving you the ability to know exactly who is impacted.
  • Resources can be tagged by Creation type, such as migrated systems or systems native to azure. This method can help with categorizing which systems was "lift and Shift" vs being created in Azure natively.
  • Tags can be used identify Production, development and QA systems

 

How to apply tags

Tags can be applied to a resource through several ways.

Applying tags manually can cause some disorganization as well when you have multiple teams working all at once so using policy to enforce tags will help ensure consistency. There are several built in Azure Policies to enforce tags:

 

Azure policy to enforce and apply tag

 

Apply tag and its default value

Appends a specified tag name and value, if that tag is not provided. You specify the tag name and value to apply.

Billing Tags Policy Initiative

Requires specified tag values for cost center and product name. Uses built-in policies to apply and enforce required tags. You specify the required values for the tags.

Enforce tag and its value

Requires a specified tag name and value. You specify the tag name and value to enforce.

Enforce tag and its value on resource groups

Requires a tag and value on a resource group. You specify the required tag name and value.

 

 

How to query your tags

Now that you've applied you've tags you can look up and query your resources. You can filter you resources via tags through the "All Resources" view in the Azure Portal or through Azure Resource Graph.

 

An example:

Using Azure Resource Graph Explorer , if I want to know which VMs in my environment that have been migrated into Azure I would query for VMs that use the CreationType tag. When the query is completed you can pin your results to the dashboard. The following query is looking for VMs that are tagged migrated and grouped by Linux and Windows server.

 

Kusto query

 

 

 

 

 

where type == "microsoft.compute/virtualmachines" 
| extend OSType = iff(type == "microsoft.compute/virtualmachines", tostring(properties.storageProfile.osDisk.osType),tostring(properties.storageProfile.operatingSystemDisk.operatingSystem)) 
|where tags.Creationtype=~'migrated'
| summarize VMCount=count() by OSType
| order by VMCount desc
|extend ['Count (Virtual Machines)']=VMCount
| project OSType, ['Count (Virtual Machines)']

 

 

 

 

 

 Running the query in Azure Resource Graph Explorer:

queryA.png

Using the chart view of the query you can also pin to your dashboard.

queryB.png

TAG ALL THINGS!!

 

As you can see from the sample above using tags helps you stay organized and gives you visibility into your Azure environment for better control and management. 

1 Comment
Senior Member

Hey @Phoummala Schmitt - Great post. As part of Cloud governance, tagging is essential. Speaking of governance, you didn't mention Azure Blueprints as another mechanism to for applying tags, although I guess blueprints use the policies which you speak about in this post. Otherwise great advise.