diff --git a/.vitepress/config.mts b/.vitepress/config.mts index 782eaba..3b3f8c0 100644 --- a/.vitepress/config.mts +++ b/.vitepress/config.mts @@ -58,6 +58,14 @@ export default defineConfig({ { text: 'Waiting For Servers', link: '/ansible/server-wait' }, ] }, + { + text: 'Azure', + link: '/azure/', + collapsed: true, + items: [ + { text: 'Identify Untagged Resources', link: '/azure/identify-untagged-resources' }, + ] + }, { text: 'CSS', link: '/css/', diff --git a/docs/azure/identify-untagged-resources.md b/docs/azure/identify-untagged-resources.md new file mode 100644 index 0000000..43cef08 --- /dev/null +++ b/docs/azure/identify-untagged-resources.md @@ -0,0 +1,28 @@ +# Identify Untagged Resources + +Tagging in Azure is essential for managing resouces, billing, ownership and more. As a general rule it's important to ensure that all resources are tagged. + +To identify untagged resources we can use the Resource Graph Explorer in Azure. This allows us to query across all our resources and filter for those that do not have tags. + +## Query for Untagged Resources + +1. Navigate to the Azure Portal and open the Resource Graph Explorer. +2. Use the following Kusto Query Language (KQL) query to find untagged resources: + +```kql +resources +| where isnull(tags) or tostring(tags) == '[]' +| project name, type, resourceGroup, location +``` + +## Recording management + +Personally I like to tag all resources with a `managed_by` tag to indicate who or what is responsible for creating/updating the resource (e.g. `manual` or `terraform` or `pulumi` etc). + +To identify resources that are not tagged with `managed_by` we can use the following query: + +```kql +resources +| where tags !has 'managed_by' +| project name, type, resourceGroup, location +``` \ No newline at end of file diff --git a/docs/azure/index.md b/docs/azure/index.md new file mode 100644 index 0000000..f42226a --- /dev/null +++ b/docs/azure/index.md @@ -0,0 +1,3 @@ +# Azure Snippets and Musings + +#### [Identify Untagged Resources](./identify-untagged-resources.md) \ No newline at end of file diff --git a/docs/index.md b/docs/index.md index d5fdd6a..adef482 100644 --- a/docs/index.md +++ b/docs/index.md @@ -18,6 +18,10 @@ hero: text: Ansible link: /ansible/ + - theme: alt + text: Azure + link: /azure/ + - theme: alt text: CSS link: /css/