Bylaw

Gallery › Kubernetes › Azure built-in policies

Configure Kubernetes clusters with Flux v2 configuration using Git repository and HTTPS secrets

Converted Policy DeployIfNotExists Disabled Mode Indexed Version 1.1.0

Deploy a 'fluxConfiguration' to Kubernetes clusters to assure that the clusters get their source of truth for workloads and configurations from the defined Git repository. This definition requires a HTTPS key secret stored in Key Vault. For instructions, visit https://aka.ms/GitOpsFlux2Policy.

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

Azure Policy JSONDeploy-GitOps-Flux2-to-Kubernetes-cluster-HTTPS-secrets_DINE.json · 466 lines
{
  "properties": {
    "displayName": "Configure Kubernetes clusters with Flux v2 configuration using Git repository and HTTPS secrets",
    "policyType": "BuiltIn",
    "mode": "Indexed",
    "description": "Deploy a 'fluxConfiguration' to Kubernetes clusters to assure that the clusters get their source of truth for workloads and configurations from the defined Git repository. This definition requires a HTTPS key secret stored in Key Vault. For instructions, visit https://aka.ms/GitOpsFlux2Policy.",
    "metadata": {
      "version": "1.1.0",
      "category": "Kubernetes"
    },
    "version": "1.1.0",
    "parameters": {
      "configurationName": {
        "type": "string",
        "metadata": {
          "displayName": "Configuration Instance Name",
          "description": "The name for the fluxConfigurations resource in Azure. Maximum of 30 lowercase alphanumeric characters or hyphens. Must start and end with an alphanumeric character. Learn more about setting up GitOps configuration: https://aka.ms/doc-use-flux2."
        }
      },
      "configurationNamespace": {
        "type": "string",
        "metadata": {
          "displayName": "Configuration Namespace",
          "description": "The namespace in the cluster within which the Flux custom resources will be installed for this configuration. This can be an existing namespace or a new one that will be created when the configuration is deployed. Maximum of 63 lowercase alphanumeric characters or hyphens. Must start and end with an alphanumeric character."
        },
        "defaultValue": "default"
      },
      "configurationScope": {
        "type": "string",
        "metadata": {
          "displayName": "Configuration Scope",
          "description": "The permission scope for the Flux configuration. Possible values are 'cluster' (create resources throughout cluster) or 'namespace' (create resources only in namespace)."
        },
        "allowedValues": [
          "cluster",
          "namespace"
        ],
        "defaultValue": "cluster"
      },
      "repositoryUrl": {
        "type": "string",
        "metadata": {
          "displayName": "Repository Url",
          "description": "The URL for the Git repository. Formats supported: http://, https://, ssh://."
        }
      },
      "repositorySyncInterval": {
        "type": "integer",
        "metadata": {
          "displayName": "Repository Sync Interval (seconds)",
          "description": "The time period, in seconds, between attempted syncs of the Git repository to the cluster."
        },
        "defaultValue": 600
      },
      "repositoryRefBranch": {
        "type": "string",
        "metadata": {
          "displayName": "Repository Reference Branch",
          "description": "The branch within the GitRepository source to sync to the cluster."
        },
        "defaultValue": ""
      },
      "repositoryRefTag": {
        "type": "string",
        "metadata": {
          "displayName": "Repository Tag",
          "description": "The tag within the GitRepository source to sync to the cluster. Takes precedence over branch."
        },
        "defaultValue": ""
      },
      "repositoryRefSemver": {
        "type": "string",
        "metadata": {
          "displayName": "Repository Semver Range",
          "description": "The tag semver range within the GitRepository source to reconcile with the cluster. Takes precedence over tag and branch."
        },
        "defaultValue": ""
      },
      "repositoryRefCommit": {
        "type": "string",
        "metadata": {
          "displayName": "Repository Commit SHA",
          "description": "The commit SHA within the GitRepository source to sync to the cluster. Takes precedence over semver and tag. May be used with branch."
        },
        "defaultValue": ""
      },
      "repositoryHttpsUser": {
        "type": "string",
        "metadata": {
          "displayName": "Plaintext HTTPS user name",
          "description": "Plaintext HTTPS username used to access private git repositories over HTTPS"
        }
      },
      "httpsKeyKeyVaultSecretName": {
        "type": "String",
        "metadata": {
          "displayName": "HTTPS-key Key Vault secret name",
          "description": "The name of the Key Vault secret that holds the base64-encoded HTTPS key."
        }
      },
      "keyVaultName": {
        "type": "String",
        "metadata": {
          "displayName": "Key Vault name",
          "description": "The name of the Key Vault that holds the HTTPS-key Key Vault secret.",
          "strongType": "Microsoft.KeyVault/vaults",
          "assignPermissions": true
        }
      },
      "repositoryHttpsCACert": {
        "type": "string",
        "metadata": {
          "displayName": "HTTPS CA Cert",
          "description": "The base64-encoded HTTPS certificate authority contents used to access private git repositories over HTTPS."
        },
        "defaultValue": ""
      },
      "kustomizationName": {
        "type": "string",
        "metadata": {
          "displayName": "Kustomization Name",
          "description": "The name of the Kustomization. Maximum of 30 lowercase alphanumeric characters or hyphen. Must start and end with an alphanumeric character."
        },
        "defaultValue": "kustomization-1"
      },
      "kustomizationPath": {
        "type": "string",
        "metadata": {
          "displayName": "Kustomization Path",
          "description": "The path within the source where the Kustomization will begin looking for manifests to reconcile. If left blank, the root path of the repository will be used."
        },
        "defaultValue": "./"
      },
      "kustomizationTimeout": {
        "type": "integer",
        "metadata": {
          "displayName": "Kustomization Timeout (seconds)",
          "description": "The sync timeout, in seconds, defines how long a Kustomization reconciliation will be allowed to continue before timing out."
        },
        "defaultValue": 600
      },
      "kustomizationSyncInterval": {
        "type": "integer",
        "metadata": {
          "displayName": "Kustomization Sync Interval (seconds)",
          "description": "The sync interval, in seconds, defines how often the Kustomization reconciles the cluster with the manifests to ensure that the cluster remains in sync with the GitRepository or Bucket source. A Kustomization sync interval more frequent than the source sync interval can be used to catch and reconcile any cluster drift."
        },
        "defaultValue": 600
      },
      "kustomizationPrune": {
        "type": "boolean",
        "metadata": {
          "displayName": "Kustomization Prune",
          "description": "Enable prune to assure that objects are removed from the cluster if they are removed from the GitRepository or Bucket source or when this Kustomization or GitOps configuration is removed from the cluster."
        },
        "defaultValue": false
      },
      "kustomizationForce": {
        "type": "boolean",
        "metadata": {
          "displayName": "Kustomization Force",
          "description": "Enable force to instruct the controller to recreate resources if they can't be changed due to an immutable field change."
        },
        "defaultValue": false
      },
      "effect": {
        "type": "String",
        "metadata": {
          "displayName": "Effect",
          "description": "Enable or disable the execution of the policy"
        },
        "allowedValues": [
          "DeployIfNotExists",
          "Disabled"
        ],
        "defaultValue": "DeployIfNotExists"
      }
    },
    "policyRule": {
      "if": {
        "field": "type",
        "in": [
          "Microsoft.Kubernetes/connectedClusters",
          "Microsoft.ContainerService/managedClusters"
        ]
      },
      "then": {
        "effect": "[parameters('effect')]",
        "details": {
          "type": "Microsoft.KubernetesConfiguration/fluxConfigurations",
          "roleDefinitionIds": [
            "/providers/microsoft.authorization/roleDefinitions/b24988ac-6180-42a0-ab88-20f7382dd24c"
          ],
          "existenceCondition": {
            "allOf": [
              {
                "field": "Microsoft.KubernetesConfiguration/fluxConfigurations/scope",
                "equals": "[parameters('configurationScope')]"
              },
              {
                "field": "Microsoft.KubernetesConfiguration/fluxConfigurations/namespace",
                "equals": "[parameters('configurationNamespace')]"
              },
              {
                "field": "Microsoft.KubernetesConfiguration/fluxConfigurations/gitRepository.url",
                "equals": "[parameters('repositoryUrl')]"
              },
              {
                "field": "Microsoft.KubernetesConfiguration/fluxConfigurations/gitRepository.syncIntervalInSeconds",
                "equals": "[parameters('repositorySyncInterval')]"
              },
              {
                "anyOf": [
                  {
                    "field": "Microsoft.KubernetesConfiguration/fluxConfigurations/gitRepository.repositoryRef.branch",
                    "equals": "[parameters('repositoryRefBranch')]"
                  },
                  {
                    "field": "Microsoft.KubernetesConfiguration/fluxConfigurations/gitRepository.repositoryRef.tag",
                    "equals": "[parameters('repositoryRefTag')]"
                  },
                  {
                    "field": "Microsoft.KubernetesConfiguration/fluxConfigurations/gitRepository.repositoryRef.semver",
                    "equals": "[parameters('repositoryRefSemver')]"
                  },
                  {
                    "field": "Microsoft.KubernetesConfiguration/fluxConfigurations/gitRepository.repositoryRef.commit",
                    "equals": "[parameters('repositoryRefCommit')]"
                  }
                ]
              },
              {
                "field": "Microsoft.KubernetesConfiguration/fluxConfigurations/gitRepository.httpsUser",
                "equals": "[parameters('repositoryHttpsUser')]"
              },
              {
                "field": "Microsoft.KubernetesConfiguration/fluxConfigurations/gitRepository.httpsCAFile",
                "equals": "[parameters('repositoryhttpsCACert')]"
              },
              {
                "field": "Microsoft.KubernetesConfiguration/fluxConfigurations/provisioningState",
                "notEquals": "Failed"
              }
            ]
          },
          "deployment": {
            "properties": {
              "mode": "incremental",
              "template": {
                "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
                "contentVersion": "1.0.0.0",
                "parameters": {
                  "clusterResourceType": {
                    "type": "string"
                  },
                  "clusterName": {
                    "type": "string"
                  },
                  "clusterLocation": {
                    "type": "string"
                  },
                  "configurationName": {
                    "type": "string"
                  },
                  "configurationNamespace": {
                    "type": "string"
                  },
                  "configurationScope": {
                    "type": "string"
                  },
                  "sourceKind": {
                    "type": "string"
                  },
                  "repositoryUrl": {
                    "type": "string"
                  },
                  "repositoryTimeout": {
                    "type": "int"
                  },
                  "repositorySyncInterval": {
                    "type": "int"
                  },
                  "repositoryRefBranch": {
                    "type": "string"
                  },
                  "repositoryRefTag": {
                    "type": "string"
                  },
                  "repositoryRefSemver": {
                    "type": "string"
                  },
                  "repositoryRefCommit": {
                    "type": "string"
                  },
                  "repositoryHttpsUser": {
                    "type": "string"
                  },
                  "repositoryHttpsKey": {
                    "type": "securestring"
                  },
                  "repositoryhttpsCACert": {
                    "type": "string"
                  },
                  "kustomizationName": {
                    "type": "string"
                  },
                  "kustomizationPath": {
                    "type": "string"
                  },
                  "kustomizationTimeout": {
                    "type": "int"
                  },
                  "kustomizationSyncInterval": {
                    "type": "int"
                  },
                  "kustomizationRetryInterval": {
                    "type": "int"
                  },
                  "kustomizationPrune": {
                    "type": "bool"
                  },
                  "kustomizationForce": {
                    "type": "bool"
                  },
                  "suspend": {
                    "type": "bool"
                  }
                },
                "resources": [
                  {
                    "comments": "Create a Flux configuration with GitRepository source in the connected (ARC) or managed (AKS) cluster using HTTPS authentication.",
                    "type": "Microsoft.KubernetesConfiguration/fluxConfigurations",
                    "name": "[parameters('configurationName')]",
                    "location": "[parameters('clusterLocation')]",
                    "apiVersion": "2022-03-01",
                    "properties": {
                      "scope": "[parameters('configurationScope')]",
                      "namespace": "[parameters('configurationNamespace')]",
                      "sourceKind": "[parameters('sourceKind')]",
                      "gitRepository": {
                        "url": "[parameters('repositoryUrl')]",
                        "timeoutInSeconds": "[parameters('repositoryTimeout')]",
                        "syncIntervalInSeconds": "[parameters('repositorySyncInterval')]",
                        "repositoryRef": {
                          "branch": "[if(not(empty(parameters('repositoryRefBranch'))), parameters('repositoryRefBranch'), json('null'))]",
                          "tag": "[if(not(empty(parameters('repositoryRefTag'))), parameters('repositoryRefTag'), json('null'))]",
                          "semver": "[if(not(empty(parameters('repositoryRefSemver'))), parameters('repositoryRefSemver'), json('null'))]",
                          "commit": "[if(not(empty(parameters('repositoryRefCommit'))), parameters('repositoryRefCommit'), json('null'))]"
                        },
                        "httpsUser": "[parameters('repositoryHttpsUser')]",
                        "httpsCACert": "[if(not(empty(parameters('repositoryhttpsCACert'))), parameters('repositoryhttpsCACert'), json('null'))]"
                      },
                      "configurationProtectedSettings": {
                        "httpsKey": "[parameters('repositoryHttpsKey')]"
                      },
                      "kustomizations": {
                        "[parameters('kustomizationName')]": {
                          "path": "[parameters('kustomizationPath')]",
                          "timeoutInSeconds": "[parameters('kustomizationTimeout')]",
                          "syncIntervalInSeconds": "[parameters('kustomizationSyncInterval')]",
                          "retryIntervalInSeconds": "[parameters('kustomizationRetryInterval')]",
                          "prune": "[parameters('kustomizationPrune')]",
                          "force": "[parameters('kustomizationForce')]"
                        }
                      },
                      "suspend": "[parameters('suspend')]"
                    },
                    "scope": "[concat(if(contains(toLower(parameters('clusterResourceType')), toLower('connectedclusters')),'Microsoft.Kubernetes/connectedClusters/','Microsoft.ContainerService/managedClusters/'),parameters('clusterName'))]"
                  }
                ]
              },
              "parameters": {
                "clusterLocation": {
                  "value": "[field('location')]"
                },
                "clusterName": {
                  "value": "[field('name')]"
                },
                "clusterResourceType": {
                  "value": "[field('type')]"
                },
                "configurationName": {
                  "value": "[parameters('configurationName')]"
                },
                "configurationNamespace": {
                  "value": "[parameters('configurationNamespace')]"
                },
                "configurationScope": {
                  "value": "[parameters('configurationScope')]"
                },
                "sourceKind": {
                  "value": "GitRepository"
                },
                "repositoryUrl": {
                  "value": "[parameters('repositoryUrl')]"
                },
                "repositoryTimeout": {
                  "value": 600
                },
                "repositorySyncInterval": {
                  "value": "[parameters('repositorySyncInterval')]"
                },
                "repositoryRefBranch": {
                  "value": "[parameters('repositoryRefBranch')]"
                },
                "repositoryRefTag": {
                  "value": "[parameters('repositoryRefTag')]"
                },
                "repositoryRefSemver": {
                  "value": "[parameters('repositoryRefSemver')]"
                },
                "repositoryRefCommit": {
                  "value": "[parameters('repositoryRefCommit')]"
                },
                "repositoryhttpsCACert": {
                  "value": "[parameters('repositoryhttpsCACert')]"
                },
                "kustomizationName": {
                  "value": "[parameters('kustomizationName')]"
                },
                "kustomizationPath": {
                  "value": "[parameters('kustomizationPath')]"
                },
                "kustomizationTimeout": {
                  "value": "[parameters('kustomizationTimeout')]"
                },
                "kustomizationSyncInterval": {
                  "value": "[parameters('kustomizationSyncInterval')]"
                },
                "kustomizationRetryInterval": {
                  "value": "[parameters('kustomizationSyncInterval')]"
                },
                "kustomizationPrune": {
                  "value": "[parameters('kustomizationPrune')]"
                },
                "kustomizationForce": {
                  "value": "[parameters('kustomizationForce')]"
                },
                "suspend": {
                  "value": false
                },
                "repositoryHttpsUser": {
                  "value": "[parameters('repositoryHttpsUser')]"
                },
                "repositoryHttpsKey": {
                  "reference": {
                    "keyVault": {
                      "id": "[parameters('keyVaultName')]"
                    },
                    "secretName": "[parameters('httpsKeyKeyVaultSecretName')]"
                  }
                }
              }
            }
          }
        }
      }
    },
    "versions": [
      "1.1.0",
      "1.0.0"
    ]
  },
  "id": "/providers/Microsoft.Authorization/policyDefinitions/bf1a31be-3b79-5ba8-c9e0-9a8c9ad9f749",
  "name": "bf1a31be-3b79-5ba8-c9e0-9a8c9ad9f749"
}
Bylawbf1a31be-3b79-5ba8-c9e0-9a8c9ad9f749.bylaw.ps1 · 182 lines
# Converted from Deploy-GitOps-Flux2-to-Kubernetes-cluster-HTTPS-secrets_DINE.json by ConvertTo-Bylaw.
Policy 'bf1a31be-3b79-5ba8-c9e0-9a8c9ad9f749' {

    Properties @{
        DisplayName   = 'Configure Kubernetes clusters with Flux v2 configuration using Git repository and HTTPS secrets'
        Description   = 'Deploy a ''fluxConfiguration'' to Kubernetes clusters to assure that the clusters get their source of truth for workloads and configurations from the defined Git repository. This definition requires a HTTPS key secret stored in Key Vault. For instructions, visit https://aka.ms/GitOpsFlux2Policy.'
        Version       = '1.1.0'
        Category      = 'Kubernetes'
        PolicyVersion = '1.1.0'
        Mode          = 'Indexed'
    }

    Parameter ConfigurationName @{
        Type        = 'string'
        DisplayName = 'Configuration Instance Name'
        Description = 'The name for the fluxConfigurations resource in Azure. Maximum of 30 lowercase alphanumeric characters or hyphens. Must start and end with an alphanumeric character. Learn more about setting up GitOps configuration: https://aka.ms/doc-use-flux2.'
    }
    Parameter ConfigurationNamespace @{
        Type        = 'string'
        Default     = 'default'
        DisplayName = 'Configuration Namespace'
        Description = 'The namespace in the cluster within which the Flux custom resources will be installed for this configuration. This can be an existing namespace or a new one that will be created when the configuration is deployed. Maximum of 63 lowercase alphanumeric characters or hyphens. Must start and end with an alphanumeric character.'
    }
    Parameter ConfigurationScope @{
        Type          = 'string'
        AllowedValues = @('cluster', 'namespace')
        Default       = 'cluster'
        DisplayName   = 'Configuration Scope'
        Description   = 'The permission scope for the Flux configuration. Possible values are ''cluster'' (create resources throughout cluster) or ''namespace'' (create resources only in namespace).'
    }
    Parameter RepositoryUrl @{
        Type        = 'string'
        DisplayName = 'Repository Url'
        Description = 'The URL for the Git repository. Formats supported: http://, https://, ssh://.'
    }
    Parameter RepositorySyncInterval @{
        Type        = 'integer'
        Default     = 600
        DisplayName = 'Repository Sync Interval (seconds)'
        Description = 'The time period, in seconds, between attempted syncs of the Git repository to the cluster.'
    }
    Parameter RepositoryRefBranch @{
        Type        = 'string'
        Default     = ''
        DisplayName = 'Repository Reference Branch'
        Description = 'The branch within the GitRepository source to sync to the cluster.'
    }
    Parameter RepositoryRefTag @{
        Type        = 'string'
        Default     = ''
        DisplayName = 'Repository Tag'
        Description = 'The tag within the GitRepository source to sync to the cluster. Takes precedence over branch.'
    }
    Parameter RepositoryRefSemver @{
        Type        = 'string'
        Default     = ''
        DisplayName = 'Repository Semver Range'
        Description = 'The tag semver range within the GitRepository source to reconcile with the cluster. Takes precedence over tag and branch.'
    }
    Parameter RepositoryRefCommit @{
        Type        = 'string'
        Default     = ''
        DisplayName = 'Repository Commit SHA'
        Description = 'The commit SHA within the GitRepository source to sync to the cluster. Takes precedence over semver and tag. May be used with branch.'
    }
    Parameter RepositoryHttpsUser @{
        Type        = 'string'
        DisplayName = 'Plaintext HTTPS user name'
        Description = 'Plaintext HTTPS username used to access private git repositories over HTTPS'
    }
    Parameter HttpsKeyKeyVaultSecretName @{
        Type        = 'String'
        DisplayName = 'HTTPS-key Key Vault secret name'
        Description = 'The name of the Key Vault secret that holds the base64-encoded HTTPS key.'
    }
    Parameter KeyVaultName @{
        Type        = 'String'
        DisplayName = 'Key Vault name'
        Description = 'The name of the Key Vault that holds the HTTPS-key Key Vault secret.'
        Metadata    = [ordered]@{ strongType = 'Microsoft.KeyVault/vaults'; assignPermissions = $true }
    }
    Parameter RepositoryHttpsCACert @{
        Type        = 'string'
        Default     = ''
        DisplayName = 'HTTPS CA Cert'
        Description = 'The base64-encoded HTTPS certificate authority contents used to access private git repositories over HTTPS.'
    }
    Parameter KustomizationName @{
        Type        = 'string'
        Default     = 'kustomization-1'
        DisplayName = 'Kustomization Name'
        Description = 'The name of the Kustomization. Maximum of 30 lowercase alphanumeric characters or hyphen. Must start and end with an alphanumeric character.'
    }
    Parameter KustomizationPath @{
        Type        = 'string'
        Default     = './'
        DisplayName = 'Kustomization Path'
        Description = 'The path within the source where the Kustomization will begin looking for manifests to reconcile. If left blank, the root path of the repository will be used.'
    }
    Parameter KustomizationTimeout @{
        Type        = 'integer'
        Default     = 600
        DisplayName = 'Kustomization Timeout (seconds)'
        Description = 'The sync timeout, in seconds, defines how long a Kustomization reconciliation will be allowed to continue before timing out.'
    }
    Parameter KustomizationSyncInterval @{
        Type        = 'integer'
        Default     = 600
        DisplayName = 'Kustomization Sync Interval (seconds)'
        Description = 'The sync interval, in seconds, defines how often the Kustomization reconciles the cluster with the manifests to ensure that the cluster remains in sync with the GitRepository or Bucket source. A Kustomization sync interval more frequent than the source sync interval can be used to catch and reconcile any cluster drift.'
    }
    Parameter KustomizationPrune @{
        Type        = 'boolean'
        Default     = $false
        DisplayName = 'Kustomization Prune'
        Description = 'Enable prune to assure that objects are removed from the cluster if they are removed from the GitRepository or Bucket source or when this Kustomization or GitOps configuration is removed from the cluster.'
    }
    Parameter KustomizationForce @{
        Type        = 'boolean'
        Default     = $false
        DisplayName = 'Kustomization Force'
        Description = 'Enable force to instruct the controller to recreate resources if they can''t be changed due to an immutable field change.'
    }
    Parameter Effect @{
        AllowedValues = @('DeployIfNotExists', 'Disabled')
        Default       = 'DeployIfNotExists'
        DisplayName   = 'Effect'
        Description   = 'Enable or disable the execution of the policy'
    }

    Resource * {

        Require 'type is not one of 2 values' {
            Field type | Must -Not -BeIn @('Microsoft.Kubernetes/connectedClusters', 'Microsoft.ContainerService/managedClusters') -IfPresent
        }
    }

    DeployIfNotExists 'Microsoft.KubernetesConfiguration/fluxConfigurations' -Role 'Contributor' -Effect (Param Effect) {
        Require 'scope, namespace, gitRepository.url and 8 more are as required' {
            Field scope | Must -Be (Param ConfigurationScope)
            Field namespace | Must -Be (Param ConfigurationNamespace)
            Field gitRepository.url | Must -Be (Param RepositoryUrl)
            Field gitRepository.syncIntervalInSeconds | Must -Be (Param RepositorySyncInterval)
            AnyOf {
                Field gitRepository.repositoryRef.branch | Must -Be (Param RepositoryRefBranch)
                Field gitRepository.repositoryRef.tag | Must -Be (Param RepositoryRefTag)
                Field gitRepository.repositoryRef.semver | Must -Be (Param RepositoryRefSemver)
                Field gitRepository.repositoryRef.commit | Must -Be (Param RepositoryRefCommit)
            }
            Field gitRepository.httpsUser | Must -Be (Param RepositoryHttpsUser)
            Field gitRepository.httpsCAFile | Must -Be (Arm '[parameters(''repositoryhttpsCACert'')]')
            Field provisioningState | Must -Not -Be 'Failed' -IfPresent
        }
        Deployment -TemplateFile './templates/bf1a31be-3b79-5ba8-c9e0-9a8c9ad9f749.json' -Parameters ([ordered]@{
                clusterLocation            = (Arm '[field(''location'')]')
                clusterName                = (Arm '[field(''name'')]')
                clusterResourceType        = (Arm '[field(''type'')]')
                configurationName          = (Param ConfigurationName)
                configurationNamespace     = (Param ConfigurationNamespace)
                configurationScope         = (Param ConfigurationScope)
                sourceKind                 = 'GitRepository'
                repositoryUrl              = (Param RepositoryUrl)
                repositoryTimeout          = 600
                repositorySyncInterval     = (Param RepositorySyncInterval)
                repositoryRefBranch        = (Param RepositoryRefBranch)
                repositoryRefTag           = (Param RepositoryRefTag)
                repositoryRefSemver        = (Param RepositoryRefSemver)
                repositoryRefCommit        = (Param RepositoryRefCommit)
                repositoryhttpsCACert      = (Arm '[parameters(''repositoryhttpsCACert'')]')
                kustomizationName          = (Param KustomizationName)
                kustomizationPath          = (Param KustomizationPath)
                kustomizationTimeout       = (Param KustomizationTimeout)
                kustomizationSyncInterval  = (Param KustomizationSyncInterval)
                kustomizationRetryInterval = (Param KustomizationSyncInterval)
                kustomizationPrune         = (Param KustomizationPrune)
                kustomizationForce         = (Param KustomizationForce)
                suspend                    = $false
                repositoryHttpsUser        = (Param RepositoryHttpsUser)
                repositoryHttpsKey         = (KeyVaultSecret -VaultId (Param KeyVaultName) -SecretName (Param HttpsKeyKeyVaultSecretName))
            })
    }
}

Its deployment templates are written beside it:

Source: built-in-policies/policyDefinitions/Kubernetes/Deploy-GitOps-Flux2-to-Kubernetes-cluster-HTTPS-secrets_DINE.json in Azure/azure-policy, under the MIT licence.