Bylaw

Gallery › Managed Application › Azure built-in policies

Application definition for Managed Application should use customer provided storage account

Converted Policy Audit Deny Disabled Mode Indexed Version 1.1.0

Use your own storage account to control the application definition data when this is a regulatory or compliance requirement. You can choose to store your managed application definition within a storage account provided by you during creation, so that its location and access can be fully managed by you to fulfill regulatory compliance requirements.

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

Azure Policy JSONApplicationDefinition_Missing_StorageAccount_Deny.json · 53 lines
{
  "properties": {
    "displayName": "Application definition for Managed Application should use customer provided storage account",
    "policyType": "BuiltIn",
    "mode": "Indexed",
    "description": "Use your own storage account to control the application definition data when this is a regulatory or compliance requirement. You can choose to store your managed application definition within a storage account provided by you during creation, so that its location and access can be fully managed by you to fulfill regulatory compliance requirements.",
    "metadata": {
      "version": "1.1.0",
      "category": "Managed Application"
    },
    "version": "1.1.0",
    "parameters": {
      "effect": {
        "type": "String",
        "metadata": {
          "displayName": "Effect",
          "description": "Enable or disable the execution of the policy."
        },
        "allowedValues": [
          "audit",
          "Audit",
          "deny",
          "Deny",
          "disabled",
          "Disabled"
        ],
        "defaultValue": "Audit"
      }
    },
    "policyRule": {
      "if": {
        "allOf": [
          {
            "field": "type",
            "equals": "Microsoft.Solutions/applicationDefinitions"
          },
          {
            "field": "Microsoft.Solutions/applicationDefinitions/storageAccountId",
            "exists": "false"
          }
        ]
      },
      "then": {
        "effect": "[parameters('effect')]"
      }
    },
    "versions": [
      "1.1.0"
    ]
  },
  "id": "/providers/Microsoft.Authorization/policyDefinitions/9db7917b-1607-4e7d-a689-bca978dd0633",
  "name": "9db7917b-1607-4e7d-a689-bca978dd0633"
}
Bylaw9db7917b-1607-4e7d-a689-bca978dd0633.bylaw.ps1 · 28 lines
# Converted from ApplicationDefinition_Missing_StorageAccount_Deny.json by ConvertTo-Bylaw.
Policy '9db7917b-1607-4e7d-a689-bca978dd0633' {

    Properties @{
        DisplayName   = 'Application definition for Managed Application should use customer provided storage account'
        Description   = 'Use your own storage account to control the application definition data when this is a regulatory or compliance requirement. You can choose to store your managed application definition within a storage account provided by you during creation, so that its location and access can be fully managed by you to fulfill regulatory compliance requirements.'
        Version       = '1.1.0'
        Category      = 'Managed Application'
        PolicyVersion = '1.1.0'
        Mode          = 'Indexed'
    }

    Parameter Effect @{
        AllowedValues = @('audit', 'Audit', 'deny', 'Deny', 'disabled', 'Disabled')
        Default       = 'Audit'
        DisplayName   = 'Effect'
        Description   = 'Enable or disable the execution of the policy.'
    }

    Resource 'Microsoft.Solutions/applicationDefinitions' {

        Require 'storageAccountId exists' {
            Field storageAccountId | Must -Exist
        }
    }

    Effect (Param Effect)
}

Source: built-in-policies/policyDefinitions/Managed Application/ApplicationDefinition_Missing_StorageAccount_Deny.json in Azure/azure-policy, under the MIT licence.