Bylaw

Gallery › Synapse › Azure built-in policies

Configure Synapse Workspaces to use only Microsoft Entra identities for authentication

Converted Policy Disabled Modify Mode All Version 1.0.0

Require and reconfigure Synapse Workspaces to use Microsoft Entra-only authentication. This policy doesn't block workspaces from being created with local authentication enabled. It does block local authentication from being enabled and re-enables Microsoft Entra-only authentication on resources after create. Consider using the 'Microsoft Entra-only authentication' initiative instead to require both. Learn more at: https://aka.ms/Synapse.

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

Azure Policy JSONWorkspaceDisableAadOnlyAuthentication_Modify.json · 70 lines
{
  "properties": {
    "displayName": "Configure Synapse Workspaces to use only Microsoft Entra identities for authentication",
    "description": "Require and reconfigure Synapse Workspaces to use Microsoft Entra-only authentication. This policy doesn't block workspaces from being created with local authentication enabled. It does block local authentication from being enabled and re-enables Microsoft Entra-only authentication on resources after create. Consider using the 'Microsoft Entra-only authentication' initiative instead to require both. Learn more at: https://aka.ms/Synapse.",
    "policyType": "BuiltIn",
    "mode": "All",
    "metadata": {
      "version": "1.0.0",
      "category": "Synapse"
    },
    "version": "1.0.0",
    "parameters": {
      "effect": {
        "type": "String",
        "metadata": {
          "displayName": "Modify",
          "description": "Enable or disable the execution of the policy"
        },
        "allowedValues": [
          "Modify",
          "Disabled"
        ],
        "defaultValue": "Modify"
      }
    },
    "policyRule": {
      "if": {
        "allOf": [
          {
            "field": "type",
            "equals": "Microsoft.Synapse/workspaces/azureADOnlyAuthentications"
          },
          {
            "anyOf": [
              {
                "field": "Microsoft.Synapse/workspaces/azureADOnlyAuthentications/azureADOnlyAuthentication",
                "exists": false
              },
              {
                "field": "Microsoft.Synapse/workspaces/azureADOnlyAuthentications/azureADOnlyAuthentication",
                "notEquals": true
              }
            ]
          }
        ]
      },
      "then": {
        "effect": "[parameters('effect')]",
        "details": {
          "conflictEffect": "audit",
          "roleDefinitionIds": [
            "/providers/microsoft.authorization/roleDefinitions/b24988ac-6180-42a0-ab88-20f7382dd24c"
          ],
          "operations": [
            {
              "operation": "addOrReplace",
              "field": "Microsoft.Synapse/workspaces/azureADOnlyAuthentications/azureADOnlyAuthentication",
              "value": true
            }
          ]
        }
      }
    },
    "versions": [
      "1.0.0"
    ]
  },
  "id": "/providers/Microsoft.Authorization/policyDefinitions/738949be-6fd2-46b9-b969-99b53712b192",
  "name": "738949be-6fd2-46b9-b969-99b53712b192"
}
Bylaw738949be-6fd2-46b9-b969-99b53712b192.bylaw.ps1 · 34 lines
# Converted from WorkspaceDisableAadOnlyAuthentication_Modify.json by ConvertTo-Bylaw.
Policy '738949be-6fd2-46b9-b969-99b53712b192' {

    Properties @{
        DisplayName   = 'Configure Synapse Workspaces to use only Microsoft Entra identities for authentication'
        Description   = 'Require and reconfigure Synapse Workspaces to use Microsoft Entra-only authentication. This policy doesn''t block workspaces from being created with local authentication enabled. It does block local authentication from being enabled and re-enables Microsoft Entra-only authentication on resources after create. Consider using the ''Microsoft Entra-only authentication'' initiative instead to require both. Learn more at: https://aka.ms/Synapse.'
        Version       = '1.0.0'
        Category      = 'Synapse'
        PolicyVersion = '1.0.0'
        Mode          = 'All'
    }

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

    Resource 'Microsoft.Synapse/workspaces/azureADOnlyAuthentications' {

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

        Require 'azureADOnlyAuthentication is true' {
            Field azureADOnlyAuthentication | Must -Be $true
        }
    }

    Modify -Role 'Contributor' -ConflictEffect Audit -Effect (Param Effect) {
        Field azureADOnlyAuthentication | AddOrReplace $true
    }
}

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