---
title: Tagging Multiple Resources
description: A quick and easy way to use the Opscompass CLI to tag multiple resources.
---

[Skip to content](https://kb.opscompass.com/knowledge/tagging-multiple-resources#main-content)

[![Opscompass](https://kb.opscompass.com/hubfs/opscompass-logo-2024-web-small.svg)](https://opscompass.com)

- [Home](https://opscompass.com/)
- [Why Opscompass](https://opscompass.com/why-opscompass/)
- Product
  
  Show submenu for Product

    - [Inventory](https://opscompass.com/inventory/)
    - [Configuration Drift](https://opscompass.com/product/configuration-drift/)
    - [Compliance](https://opscompass.com/product/compliance/)
    - [Licenses](https://opscompass.com/solutions/licenses/)
- Solutions
  
  Show submenu for Solutions

    - [Hybrid and Multi-Cloud Visibility](https://opscompass.com/solutions/multi-cloud-visibility/)
- [About Us](https://opscompass.com/company/)

Open main navigation

Close main navigation

- [Home](https://opscompass.com/)
- [Why Opscompass](https://opscompass.com/why-opscompass/)
- Product
  
  Show submenu for Product

    - [Inventory](https://opscompass.com/inventory/)
    - [Configuration Drift](https://opscompass.com/product/configuration-drift/)
    - [Compliance](https://opscompass.com/product/compliance/)
    - [Licenses](https://opscompass.com/solutions/licenses/)
- Solutions
  
  Show submenu for Solutions

    - [Hybrid and Multi-Cloud Visibility](https://opscompass.com/solutions/multi-cloud-visibility/)
- [About Us](https://opscompass.com/company/)
- [Get a Demo](https://opscompass.com/demo/)

[Get a Demo](https://opscompass.com/demo/)

 What are you looking for?

- There are no suggestions because the search field is empty.

1. [Help Center](https://kb.opscompass.com/knowledge)
2. [Tutorials](https://kb.opscompass.com/knowledge/tutorials)

# Tagging Multiple Resources

## Using the Opscompass CLI and basic scripting, users can tag multiple Opscompass resources in an automated way.

The Opscompass CLI has the versatility to be used in scripts to automate processes such as tagging multiple items. In a situation where you have a list of the Cloud Resource IDs, or the Opscompass IDs, this is an example of how to tag multiple resources. This can be useful so that users can then sort by these 

**Prerequisites**  
Opscompass CLI Installed

**Getting the Data**  
The opscompass CLI has two required paramaters. The COMPANY and either the RESOURCE-ID (the cloud resource id) or the ID(the opscompass resource id). You can get the ID by exporting a list of resources from the Inventory in Opscompass. This export will give the user a CSV, with the final item in the list being the link to the resource which includes the ID (ex. https://app.opscompass.com/opscompass/inventory/***10206142).*** Users can use tools like excel to to do a 'TEXTSPLIT' to isolate the IDs from Opscompass.

Similarly, users can get a list of resources from a cloud provider to get the RESOURCE-ID("/subscriptions/8deb6078-c9af-4841-b5c5-b7743c23dbd7/resourceGroups/tutorial").

**Tagging the Data**  
Lets say you get a list of IDs from Opscompass in a file called `resources.txt`

| 932859 932932 933007 10204213 |
| --- |

You can set up a simple script, in this case a bash script, to loop through and tag those items using the opscompass command  
`opscompass resources add-tags --company <name of company in Opscompass> --id <Opscompass resource ID> --tag <tag>`

| `#!/bin/bash` `FILE="resources.txt"` `while IFS= read -r line; do` `    opscompass resources add-tags --company opscompass --id $line --tag "example-tag" ` `done < "$FILE"` |
| --- |

 

 These tags will now be attached to the resources in Opscompass.

 

![example-tag-screenshot](https://kb.opscompass.com/hs-fs/hubfs/example-tag-screenshot.png?width=670&height=441&name=example-tag-screenshot.png)

 

 

- [About Opscompass](https://kb.opscompass.com/knowledge/about-opscompass#main-content)

    - [Company Information](https://kb.opscompass.com/knowledge/about-opscompass#company-information)
- [Getting Started](https://kb.opscompass.com/knowledge/getting-started#main-content)

    - [Logging In](https://kb.opscompass.com/knowledge/getting-started#logging-in)
    - [Connecting Cloud Accounts](https://kb.opscompass.com/knowledge/getting-started#connecting-cloud-accounts)
    - [Users and Teams](https://kb.opscompass.com/knowledge/getting-started#users-and-teams)
- [Opscompass CLI](https://kb.opscompass.com/knowledge/opscompass-cli#main-content)

    - [Getting Started](https://kb.opscompass.com/knowledge/opscompass-cli#getting-started)
    - [Resources](https://kb.opscompass.com/knowledge/opscompass-cli#resources)
    - [Accounts](https://kb.opscompass.com/knowledge/opscompass-cli#accounts)
    - [Compliance](https://kb.opscompass.com/knowledge/opscompass-cli#compliance)
    - [Licensing](https://kb.opscompass.com/knowledge/opscompass-cli#licensing)
    - [Examples](https://kb.opscompass.com/knowledge/opscompass-cli#examples)
    - [AI Skills](https://kb.opscompass.com/knowledge/opscompass-cli#ai-skills)
- [Opscompass FAQs](https://kb.opscompass.com/knowledge/opscompass-faqs#main-content)

    - [General](https://kb.opscompass.com/knowledge/opscompass-faqs#general)
- [New Features](https://kb.opscompass.com/knowledge/new-features)
- [Account Management](https://kb.opscompass.com/knowledge/account-management)
- [Compliance](https://kb.opscompass.com/knowledge/compliance)
- [Documents](https://kb.opscompass.com/knowledge/documents)
- [Drift](https://kb.opscompass.com/knowledge/drift)
- [Inventory](https://kb.opscompass.com/knowledge/inventory)
- [Licenses](https://kb.opscompass.com/knowledge/licenses#main-content)

    - [Oracle](https://kb.opscompass.com/knowledge/licenses#oracle)
    - [SQL Server](https://kb.opscompass.com/knowledge/licenses#sql-server)
- [Navigation and Dashboard](https://kb.opscompass.com/knowledge/navigation-and-dashboard)
- [Opscompass Integrations](https://kb.opscompass.com/knowledge/opscompass-integrations)
- [Tutorials](https://kb.opscompass.com/knowledge/tutorials#main-content)

    - [CLI](https://kb.opscompass.com/knowledge/tutorials#cli)

[![Opscompass](https://kb.opscompass.com/hubfs/opscompass-logo-2024-web-small.svg "Opscompass")](http://opscompass.com)

<https://opscompass.com/contact/> <https://www.linkedin.com/company/opscompass/>

Copyright © 2025, Opscompass