last sync: 2021-May-10 15:04:35 UTC

Azure Policy definition

Configure private endpoint connections on Azure Automation accounts

Name Configure private endpoint connections on Azure Automation accounts
Azure Portal
Id c0c3130e-7dda-4187-aed0-ee4a472eaa60
Version 1.0.0
details on versioning
Category Automation
Microsoft docs
Description Private endpoint connections allow secure communication by enabling private connectivity to Azure Automation accounts without a need for public IP addresses at the source or destination. Learn more about private endpoints in Azure Automation at https://docs.microsoft.com/azure/automation/how-to/private-link-security.
Mode Indexed
Type BuiltIn
Preview FALSE
Deprecated FALSE
Effect Default: DeployIfNotExists
Allowed: (DeployIfNotExists, Disabled)
Used RBAC Role
Role Name Role Id
Network Contributor 4d97b98b-1d4f-4787-a291-c67834d212e7
Contributor b24988ac-6180-42a0-ab88-20f7382dd24c
History
Date/Time (UTC ymd) (i) Change type Change detail
2021-03-09 14:37:41 add c0c3130e-7dda-4187-aed0-ee4a472eaa60
Used in Initiatives none
JSON
{
  "properties": {
    "displayName": "Configure private endpoint connections on Azure Automation accounts",
    "policyType": "BuiltIn",
    "mode": "Indexed",
    "description": "Private endpoint connections allow secure communication by enabling private connectivity to Azure Automation accounts without a need for public IP addresses at the source or destination. Learn more about private endpoints in Azure Automation at https://docs.microsoft.com/azure/automation/how-to/private-link-security.",
    "metadata": {
      "version": "1.0.0",
      "category": "Automation"
    },
    "parameters": {
      "privateEndpointSubnetId": {
        "type": "String",
        "metadata": {
          "displayName": "Private endpoint subnet id",
          "description": "A subnet with private endpoint network policies disabled",
          "strongType": "Microsoft.Network/virtualNetworks/subnets"
        }
      },
      "effect": {
        "type": "String",
        "metadata": {
          "displayName": "Effect",
          "description": "Enable or disable the execution of the policy"
        },
        "allowedValues": [
          "DeployIfNotExists",
          "Disabled"
        ],
        "defaultValue": "DeployIfNotExists"
      }
    },
    "policyRule": {
      "if": {
        "field": "type",
        "equals": "Microsoft.Automation/automationAccounts"
      },
      "then": {
      "effect": "[parameters('effect')]",
        "details": {
          "type": "Microsoft.Automation/automationAccounts/privateEndpointConnections",
          "existenceCondition": {
            "field": "Microsoft.Automation/automationAccounts/privateEndpointConnections/privateLinkServiceConnectionState.status",
            "equals": "Approved"
          },
          "roleDefinitionIds": [
            "/providers/Microsoft.Authorization/roleDefinitions/4d97b98b-1d4f-4787-a291-c67834d212e7",
            "/providers/Microsoft.Authorization/roleDefinitions/b24988ac-6180-42a0-ab88-20f7382dd24c"
          ],
          "deployment": {
            "properties": {
              "mode": "incremental",
              "parameters": {
                "name": {
                "value": "[field('name')]"
                },
                "serviceId": {
                "value": "[field('id')]"
                },
                "privateEndpointSubnetId": {
                "value": "[parameters('privateEndpointSubnetId')]"
                }
              },
              "template": {
                "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
                "contentVersion": "1.0.0.0",
                "parameters": {
                  "name": {
                    "type": "string"
                  },
                  "serviceId": {
                    "type": "string"
                  },
                  "privateEndpointSubnetId": {
                    "type": "string"
                  }
                },
                "variables": {
                "privateEndpointName": "[concat('pe-',substring(parameters('name'),0,min(length(parameters('name')),50)),'-',uniquestring(deployment().name))]"
                },
                "resources": [
                  {
                    "type": "Microsoft.Resources/deployments",
                  "name": "[variables('privateEndpointName')]",
                    "apiVersion": "2020-06-01",
                    "properties": {
                      "mode": "Incremental",
                      "expressionEvaluationOptions": {
                        "scope": "inner"
                      },
                      "template": {
                        "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
                        "contentVersion": "1.0.0.0",
                        "parameters": {
                          "serviceId": {
                            "type": "string"
                          },
                          "privateEndpointSubnetId": {
                            "type": "string"
                          },
                          "subnetLocation": {
                            "type": "string"
                          }
                        },
                        "variables": {
                        "privateEndpointName": "[deployment().name]"
                        },
                        "resources": [
                          {
                          "name": "[concat(variables('privateEndpointName'),'Webhook')]",
                            "type": "Microsoft.Network/privateEndpoints",
                            "apiVersion": "2020-07-01",
                          "location": "[parameters('subnetLocation')]",
                            "tags": {
                              
                            },
                            "properties": {
                              "subnet": {
                              "id": "[parameters('privateEndpointSubnetId')]"
                              },
                              "privateLinkServiceConnections": [
                                {
                                "name": "[concat(variables('privateEndpointName'),'Webhook')]",
                                  "properties": {
                                  "privateLinkServiceId": "[parameters('serviceId')]",
                                    "groupIds": [
                                      "Webhook"
                                    ],
                                    "requestMessage": "autoapprove"
                                  }
                                }
                              ],
                              "manualPrivateLinkServiceConnections": [
                                
                              ]
                            }
                          },
                          {
                          "name": "[concat(variables('privateEndpointName'),'DSCAndHybridWorker')]",
                            "type": "Microsoft.Network/privateEndpoints",
                            "apiVersion": "2020-07-01",
                          "location": "[parameters('subnetLocation')]",
                            "tags": {
                              
                            },
                            "properties": {
                              "subnet": {
                              "id": "[parameters('privateEndpointSubnetId')]"
                              },
                              "privateLinkServiceConnections": [
                                {
                                "name": "[concat(variables('privateEndpointName'),'DSCAndHybridWorker')]",
                                  "properties": {
                                  "privateLinkServiceId": "[parameters('serviceId')]",
                                    "groupIds": [
                                      "DSCAndHybridWorker"
                                    ],
                                    "requestMessage": "autoapprove"
                                  }
                                }
                              ],
                              "manualPrivateLinkServiceConnections": [
                                
                              ]
                            }
                          }
                        ]
                      },
                      "parameters": {
                        "serviceId": {
                        "value": "[parameters('serviceId')]"
                        },
                        "privateEndpointSubnetId": {
                        "value": "[parameters('privateEndpointSubnetId')]"
                        },
                        "subnetLocation": {
                        "value": "[reference(first(take(split(parameters('privateEndpointSubnetId'),'/subnets'),1)),'2020-07-01','Full').location]"
                        }
                      }
                    }
                  }
                ]
              }
            }
          }
        }
      }
    }
  },
  "id": "/providers/Microsoft.Authorization/policyDefinitions/c0c3130e-7dda-4187-aed0-ee4a472eaa60",
  "type": "Microsoft.Authorization/policyDefinitions",
  "name": "c0c3130e-7dda-4187-aed0-ee4a472eaa60"
}