Bylaw

Gallery › Planetary Computer › Azure built-in policies

Microsoft Planetary Computer Pro GeoCatalogs should use a managed identity

Converted Policy Audit Deny Disabled Mode Indexed Version 1.0.0

Assigning a managed identity to a Planetary Computer GeoCatalog lets it securely access source Storage accounts (Storage Blob Data Reader) for data ingestion without you managing secrets.

ConvertTo-Bylaw converted this policy, and proved that the file compiles back to the same definition.

Azure Policy JSONManagedIdentity_Audit.json · 58 lines
{
  "properties": {
    "displayName": "Microsoft Planetary Computer Pro GeoCatalogs should use a managed identity",
    "policyType": "BuiltIn",
    "mode": "Indexed",
    "description": "Assigning a managed identity to a Planetary Computer GeoCatalog lets it securely access source Storage accounts (Storage Blob Data Reader) for data ingestion without you managing secrets.",
    "metadata": {
      "version": "1.0.0",
      "category": "Planetary Computer"
    },
    "version": "1.0.0",
    "parameters": {
      "effect": {
        "type": "string",
        "defaultValue": "Audit",
        "allowedValues": [
          "Audit",
          "Deny",
          "Disabled"
        ],
        "metadata": {
          "displayName": "Effect",
          "description": "The effect determines what happens when the policy rule is evaluated to match"
        }
      }
    },
    "policyRule": {
      "if": {
        "allOf": [
          {
            "field": "type",
            "equals": "Microsoft.Orbital/geocatalogs"
          },
          {
            "anyOf": [
              {
                "field": "identity.type",
                "exists": "false"
              },
              {
                "field": "identity.type",
                "equals": "None"
              }
            ]
          }
        ]
      },
      "then": {
        "effect": "[parameters('effect')]"
      }
    },
    "versions": [
      "1.0.0"
    ]
  },
  "id": "/providers/Microsoft.Authorization/policyDefinitions/9fac9537-cba6-480a-97dc-21a93c1aa055",
  "name": "9fac9537-cba6-480a-97dc-21a93c1aa055"
}
Bylaw9fac9537-cba6-480a-97dc-21a93c1aa055.bylaw.ps1 · 33 lines
# Converted from ManagedIdentity_Audit.json by ConvertTo-Bylaw.
Policy '9fac9537-cba6-480a-97dc-21a93c1aa055' {

    Properties @{
        DisplayName   = 'Microsoft Planetary Computer Pro GeoCatalogs should use a managed identity'
        Description   = 'Assigning a managed identity to a Planetary Computer GeoCatalog lets it securely access source Storage accounts (Storage Blob Data Reader) for data ingestion without you managing secrets.'
        Version       = '1.0.0'
        Category      = 'Planetary Computer'
        PolicyVersion = '1.0.0'
        Mode          = 'Indexed'
    }

    Parameter Effect @{
        Type          = 'string'
        AllowedValues = @('Audit', 'Deny', 'Disabled')
        Default       = 'Audit'
        DisplayName   = 'Effect'
        Description   = 'The effect determines what happens when the policy rule is evaluated to match'
    }

    Resource 'Microsoft.Orbital/geocatalogs' {

        Require 'identity.type exists' {
            Field identity.type | Must -Exist
        }

        Require 'identity.type is not None' {
            Field identity.type | Must -Not -Be 'None' -IfPresent
        }
    }

    Effect (Param Effect)
}

Source: built-in-policies/policyDefinitions/Planetary Computer/ManagedIdentity_Audit.json in Azure/azure-policy, under the MIT licence.