Skip to content

Update azure_mandatory_sql_subscription_resource_group_mandatory.yaml #31

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@

id: azure_mandatory_sql_subscription_resource_group_mandatory
title: Resource groups should have mandatory tags
description: Check if Resource groups have mandatory tags.
integration_type:
- azure_subscription
parameters:
- key: azureMandatoryTags
value: '["name","environment"]'
value: $global.mandatory_tags
policy:
language: sql
primary_resource: azure_resource_group
Expand All @@ -16,8 +17,9 @@ policy:
platform_resource_id,
id,
title,
tags ?& '{{.azureMandatoryTags}}'::text[] AS has_mandatory_tags,
TO_JSONB('{{.azureMandatoryTags}}'::text[]) - ARRAY(
-- Use the $global.mandatory_tags reference in the SQL
tags ?& $global.mandatory_tags::text[] AS has_mandatory_tags,
TO_JSONB($global.mandatory_tags::text[]) - ARRAY(
SELECT jsonb_object_keys(tags)
) AS missing_tags,
subscription_id
Expand All @@ -37,7 +39,8 @@ policy:
ELSE title || ' is missing tags: ' || array_to_string(
ARRAY(
SELECT jsonb_array_elements_text(missing_tags)
), ', ') || '.'
), ', '
) || '.'
END AS reason,
subscription_id
FROM
Expand Down