Bylaw

Gallery › Data Factory › Azure built-in policies

Azure Data Factory should use a Git repository for source control

Converted Policy Audit Deny Disabled Mode Indexed Version 1.0.1

Configure only your development data factory with Git integration. Changes to test and production should be deployed via CI/CD and should NOT have Git integration. DO NOT apply this policy on your QA / Test / Production data factories.

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

Azure Policy JSONFactory_None_GIT_Audit.json · 58 lines
{
  "properties": {
    "displayName": "Azure Data Factory should use a Git repository for source control",
    "policyType": "BuiltIn",
    "mode": "Indexed",
    "description": "Configure only your development data factory with Git integration. Changes to test and production should be deployed via CI/CD and should NOT have Git integration.  DO NOT apply this policy on your QA / Test / Production data factories.",
    "metadata": {
      "version": "1.0.1",
      "category": "Data Factory"
    },
    "version": "1.0.1",
    "parameters": {
      "effect": {
        "type": "String",
        "metadata": {
          "displayName": "Effect",
          "description": "Enable or disable the execution of the policy"
        },
        "allowedValues": [
          "Audit",
          "Deny",
          "Disabled"
        ],
        "defaultValue": "Audit"
      }
    },
    "policyRule": {
      "if": {
        "allOf": [
          {
            "field": "type",
            "equals": "Microsoft.DataFactory/factories"
          },
          {
            "anyOf": [
              {
                "field": "Microsoft.DataFactory/factories/repoConfiguration.repositoryName",
                "exists": "false"
              },
              {
                "field": "Microsoft.DataFactory/factories/repoConfiguration.repositoryName",
                "equals": ""
              }
            ]
          }
        ]
      },
      "then": {
        "effect": "[parameters('effect')]"
      }
    },
    "versions": [
      "1.0.1"
    ]
  },
  "id": "/providers/Microsoft.Authorization/policyDefinitions/77d40665-3120-4348-b539-3192ec808307",
  "name": "77d40665-3120-4348-b539-3192ec808307"
}
Bylaw77d40665-3120-4348-b539-3192ec808307.bylaw.ps1 · 32 lines
# Converted from Factory_None_GIT_Audit.json by ConvertTo-Bylaw.
Policy '77d40665-3120-4348-b539-3192ec808307' {

    Properties @{
        DisplayName   = 'Azure Data Factory should use a Git repository for source control'
        Description   = 'Configure only your development data factory with Git integration. Changes to test and production should be deployed via CI/CD and should NOT have Git integration.  DO NOT apply this policy on your QA / Test / Production data factories.'
        Version       = '1.0.1'
        Category      = 'Data Factory'
        PolicyVersion = '1.0.1'
        Mode          = 'Indexed'
    }

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

    Resource 'Microsoft.DataFactory/factories' {

        Require 'repoConfiguration.repositoryName exists' {
            Field repoConfiguration.repositoryName | Must -Exist
        }

        Require 'repoConfiguration.repositoryName is not' {
            Field repoConfiguration.repositoryName | Must -Not -Be '' -IfPresent
        }
    }

    Effect (Param Effect)
}

Source: built-in-policies/policyDefinitions/Data Factory/Factory_None_GIT_Audit.json in Azure/azure-policy, under the MIT licence.