Organise your Resources with Tags
Tags: resourcetags, organiseresources, tag, keyvaluepair
Published: 2023-06-27 16:52:23

Classifying your resources in the cloud environment is very essential. This will enable you to identify your resources based on the setup that obtains in your organisation.

Tags are used to identify resources in the cloud. They are descriptive metadata that helps you to logically arrange your resources into a taxonomy. It consists of key-value pair. That is,  a tag is a label made up of a key and an optional value.
It can be applied to Azure resources, resource groups, and subscriptions.

It helps in identifying cost of different business processes in the cloud. Organisations can use tags to identify billings associated with each departments cloud resources usage. For example, The employees' names and their departments may be used as a key-value pair:

<u>Name of Employee</u>  <u>Department</u>   <u>Tag(key:value)</u>
Gladys                     Procurement         Gladys:Procurement
Richard                    Finance             Richard:Finance
Catherine                  Sales               Catherine: Sales

Other parameters can be used to create a key:value pair depending on the Company's setup and mode of operations.

Next, we will see how Resource tagging can be implemented in Microsoft Azure. The following steps will guide you

<u>Step 1</u>
Log in to azure Portal
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/tazav591igjp0palr9mt.png)

<u>Step 2</u>
Type 'Policy' into the Search bar and click on it



![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/m0t1hcp5not34uekq294.png)



 
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/frfzho80jwdvwqp93o82.png)

<u>Step 3</u>
Click on 'Assignments' to Assign a Policy


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/8evxzxnadpgjqf8chz8g.png)

Then Click on 'Assign Policy'


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/1xkcnny1pp6j3x8nvvqw.png)


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/hy0ij62s1k2cfnrw8j2p.png)

Click on the small box in front of Policy Definitions and wait for it to come up

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/8xtyyzwqs2ck2fj6uxhw.png)

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ngtdltv8fj71njdfxgn9.png)

Type Tag in the Search box of the Available Definitions and Select 'Require a tag and its value on Resources'
Then Click on 'Add'

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/cuemhyp7o7tn2jxggog7.png)


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/o9pb64qzq0lf6kd15c49.png)
Go to Parameters and give the Tag a name and the Tag value too
The name will be Company and the Value will be Eunicloud
Therefore, the Key:Value pair is **Company:Eunicloud**
Please note that tag values are case sensitive.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/18w5jebhwjja0pe0kw4w.png)

Click on 'Review and Create'

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/92ps3x19piajj92lqsid.png)

Then, Click on 'Create'



![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/hynu258wxa2o9njexri3.png)

A policy assignment was created to implement resource tagging.

<u>Step 4</u>
Go back to Azure portal Home page and click on Storage account

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/3zgj3dxexn550xjcf8km.png)

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/d9ucn7xh2fojk5e8fy06.png)

Click on 'Create'

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ggfo29cm9dm8cwrs0uqr.png)

Complete the Project details and Instance details
I will select my subscription, **Azure Pass Sponsorship** and Resource group is **UniRg**

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/xyh1im3hxz4mxnb4vptq.png)

The name of my Storage account is **yemmystore** (this is a random name. You can give yours any name of your choice) and I will select **East US** for the Region


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/uofdi81xkau7m2eviw3h.png)



Click on 'Review'

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/x00huiesxq9aengst17i.png)

The Validation of the Storage account failed and could not be created. This is because of the Policy that is already assigned, requires that any resource to be created should be tagged **Company:Eunicloud**
Therefore, we have to assign the tag to yemmystore so that it can be created


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/sijlslurlaxr2zyz6cy2.png)

Then Click on 'Review'

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ngslpdzonped4jum1c6w.png)


Then, Click on 'Create' and wait for the deployment to complete


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ogdl713tz0epm3pot4ai.png)

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/vgjmznr1d3kkle5e43gz.png)

The Storage Account **yemmystore**    has been created with the tag 
     **Company:Eunicloud**


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/vk0jy2tbsg95x2qo7ljc.png)

<u>Step 5</u>
Go back to the Home page of the Azure portal and select Policy


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ga0767p67r316f9muw7l.png)

Click on 'Assignments'


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/l9dy4ydyx823d15e7kjg.png)



Then Click on the Assignment name 'Require a tag and its value on Resources'


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/dy3nce3pzigfm0buppcn.png)



Click on 'Delete Assignment'

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/d1e12rlptuxnkrjmi266.png)

Select Yes in the Dialog box

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/2pvlg49na9lbpzavs8t2.png)

The Policy assignment has been successfully deleted

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/37vag82v68ebjyokx73q.png)


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/v3bsg6p3bgioiplil734.png)

I hope this is useful. When next you are creating your resources, try it out. Your workload will be well organised.

Comments are welcomed.