Use a tag policy for automatic detection

更新时间:
复制 MD 格式

Tag policies let you check resources for missing or non-compliant tags. With automatic tag detection, non-compliance issues are identified earlier and more comprehensively.

Prerequisites

Ensure you have enabled the tag policy feature. For more information, see Enable the Tag Policy feature.

Background information

For a list of Alibaba Cloud services that support automatic tag detection, see the Support for automatic tag detection and automatic tag remediation column in Alibaba Cloud services that support tag policies.

Procedure

The following example uses a tag policy to automatically check whether all resources in the current Alibaba Cloud account have the CostCenter tag.

  1. Log on to the Resource Management console.

  2. Create a tag policy.

    1. On the Policy Library page, click Create Tag Policy.

    2. Enter a policy name.

    3. Optional: Enter a policy description.

    4. Configure the policy on the Quick Mode tab.

      1. For Policy Scenario, select Add Tags with Specified Tag Values to Resources.

      2. In the Tag Key field, enter CostCenter.

      3. Enter the allowed tag values.

        You can set tag values based on your use case:

        • Detect resources that are missing a specific tag key

          In this example, if you set the tag key to CostCenter and the tag value to *, the policy detects all resources that are missing the CostCenter tag key.

          Note

          The asterisk (*) represents any tag value.

        • Detect resources that are missing a specific tag

          In this example, if you set the tag key to CostCenter and the tag value to Beijing, the policy detects resources that are missing the tag CostCenter:Beijing.

          You can specify multiple tag values. Enter each tag value on a new line.

    5. Click Create.

  3. Attach the tag policy.

    Attach the tag policy that you created in Step 2 to the current Alibaba Cloud account. The policy then takes effect on the account and its RAM users.

    For more information, see Attach a tag policy.

  4. View the effective policy.

    The effective policy is the combination of all tag policies attached to the current account. For more information, see View an effective policy.

  5. Wait for the detection task to complete, and then view the automatic detection results.

    The system automatically detects resources with non-compliant tags. You can view or download the detection results.

    For more information, see View and download non-compliance detection results.

Next steps

To fix non-compliant resources, you can manually correct their tags or enable automatic remediation. For more information about automatic tag remediation, see Use a tag policy for automatic tag remediation.

After remediation, review the detection results to verify compliance.