Bylaw

Gallery › Synapse › Azure built-in policies

Synapse managed private endpoints should only connect to resources in approved Azure Active Directory tenants

Converted Policy Audit Deny Disabled Mode Indexed Version 1.0.0

Protect your Synapse workspace by only allowing connections to resources in approved Azure Active Directory (Azure AD) tenants. The approved Azure AD tenants can be defined during policy assignment.

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

Azure Policy JSONWorkspace_DataExfiltrationPrevention_Deny.json · 64 lines
{
  "properties": {
    "displayName": "Synapse managed private endpoints should only connect to resources in approved Azure Active Directory tenants",
    "policyType": "BuiltIn",
    "mode": "Indexed",
    "description": "Protect your Synapse workspace by only allowing connections to resources in approved Azure Active Directory (Azure AD) tenants. The approved Azure AD tenants can be defined during policy assignment.",
    "metadata": {
      "version": "1.0.0",
      "category": "Synapse"
    },
    "version": "1.0.0",
    "parameters": {
      "allowedTenantIds": {
        "type": "Array",
        "metadata": {
          "displayName": "List of Allowed Tenant Ids for private endpoint creation",
          "description": "This parameter defines the list of Allowed Tenant Ids that are allowed to create managed private endpoints in the workspaces"
        },
        "defaultValue": []
      },
      "effect": {
        "type": "String",
        "defaultValue": "Audit",
        "allowedValues": [
          "Audit",
          "Disabled",
          "Deny"
        ],
        "metadata": {
          "displayName": "Effect",
          "description": "Enable or disable the execution of the policy"
        }
      }
    },
    "policyRule": {
      "if": {
        "allOf": [
          {
            "field": "type",
            "equals": "Microsoft.Synapse/workspaces"
          },
          {
            "count": {
              "field": "Microsoft.Synapse/workspaces/managedVirtualNetworkSettings.allowedAadTenantIdsForLinking[*]",
              "where": {
                "field": "Microsoft.Synapse/workspaces/managedVirtualNetworkSettings.allowedAadTenantIdsForLinking[*]",
                "notIn": "[parameters('allowedTenantIds')]"
              }
            },
            "greater": 0
          }
        ]
      },
      "then": {
        "effect": "[parameters('effect')]"
      }
    },
    "versions": [
      "1.0.0"
    ]
  },
  "id": "/providers/Microsoft.Authorization/policyDefinitions/3a003702-13d2-4679-941b-937e58c443f0",
  "name": "3a003702-13d2-4679-941b-937e58c443f0"
}
Bylaw3a003702-13d2-4679-941b-937e58c443f0.bylaw.ps1 · 36 lines
# Converted from Workspace_DataExfiltrationPrevention_Deny.json by ConvertTo-Bylaw.
Policy '3a003702-13d2-4679-941b-937e58c443f0' {

    Properties @{
        DisplayName   = 'Synapse managed private endpoints should only connect to resources in approved Azure Active Directory tenants'
        Description   = 'Protect your Synapse workspace by only allowing connections to resources in approved Azure Active Directory (Azure AD) tenants. The approved Azure AD tenants can be defined during policy assignment.'
        Version       = '1.0.0'
        Category      = 'Synapse'
        PolicyVersion = '1.0.0'
        Mode          = 'Indexed'
    }

    Parameter AllowedTenantIds @{
        Type        = 'Array'
        Default     = @()
        DisplayName = 'List of Allowed Tenant Ids for private endpoint creation'
        Description = 'This parameter defines the list of Allowed Tenant Ids that are allowed to create managed private endpoints in the workspaces'
    }
    Parameter Effect @{
        AllowedValues = @('Audit', 'Disabled', 'Deny')
        Default       = 'Audit'
        DisplayName   = 'Effect'
        Description   = 'Enable or disable the execution of the policy'
    }

    Resource 'Microsoft.Synapse/workspaces' {

        Require 'managedVirtualNetworkSettings.allowedAadTenantIdsForLinking is as required' {
            Each 'managedVirtualNetworkSettings.allowedAadTenantIdsForLinking[*]' {
                Element | Must -BeIn (Param AllowedTenantIds)
            }
        }
    }

    Effect (Param Effect)
}

Source: built-in-policies/policyDefinitions/Synapse/Workspace_DataExfiltrationPrevention_Deny.json in Azure/azure-policy, under the MIT licence.