Gallery › Data Factory › Azure built-in policies
Azure Data Factory linked services should use system-assigned managed identity authentication when it is supported
Converted Policy Audit Deny Disabled Mode All Version 2.1.0
Using system-assigned managed identity when communicating with data stores via linked services avoids the use of less secured credentials such as passwords or connection strings.
ConvertTo-Bylaw converted this policy, and proved that the file compiles back to the same definition.
Azure Policy JSONLinkedService_All_Auth_Audit_except_MSI.json · 100 lines
{
"properties": {
"displayName": "Azure Data Factory linked services should use system-assigned managed identity authentication when it is supported",
"policyType": "BuiltIn",
"mode": "All",
"description": "Using system-assigned managed identity when communicating with data stores via linked services avoids the use of less secured credentials such as passwords or connection strings.",
"metadata": {
"version": "2.1.0",
"category": "Data Factory"
},
"version": "2.1.0",
"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/linkedservices"
},
{
"field": "Microsoft.DataFactory/factories/linkedservices/type",
"in": [
"AzureSqlDatabase",
"AzureSqlMI",
"AzureSqlDW",
"AzureBlobFS",
"AdlsGen2CosmosStructuredStream",
"AzureDataLakeStore",
"AzureDataLakeStoreCosmosStructuredStream",
"AzureBlobStorage",
"AzureDatabricks"
]
},
{
"anyOf": [
{
"field": "Microsoft.DataFactory/factories/linkedservices/typeProperties.connectionString",
"contains": "User ID="
},
{
"field": "Microsoft.DataFactory/factories/linkedservices/typeProperties.connectionString",
"contains": "AccountKey="
},
{
"field": "Microsoft.DataFactory/factories/linkedservices/AzureSqlDW.typeProperties.servicePrincipalKey",
"exists": "true"
},
{
"field": "Microsoft.DataFactory/factories/linkedservices/AzureStorage.typeProperties.accountKey",
"exists": "true"
},
{
"field": "Microsoft.DataFactory/factories/linkedservices/AzureStorage.typeProperties.sasUri",
"exists": "true"
},
{
"field": "Microsoft.DataFactory/factories/linkedservices/Hubspot.typeProperties.accessToken",
"exists": "true"
},
{
"field": "Microsoft.DataFactory/factories/linkedservices/typeProperties.encryptedCredential",
"exists": "true"
},
{
"field": "Microsoft.DataFactory/factories/linkedservices/AzureBlobStorage.typeProperties.credential.type",
"exists": "true"
},
{
"field": "Microsoft.DataFactory/factories/linkedservices/AzureBlobFS.typeProperties.servicePrincipalCredential",
"exists": "true"
}
]
}
]
},
"then": {
"effect": "[parameters('effect')]"
}
},
"versions": [
"2.1.0"
]
},
"id": "/providers/Microsoft.Authorization/policyDefinitions/f78ccdb4-7bf4-4106-8647-270491d2978a",
"name": "f78ccdb4-7bf4-4106-8647-270491d2978a"
}Bylawf78ccdb4-7bf4-4106-8647-270491d2978a.bylaw.ps1 · 64 lines
# Converted from LinkedService_All_Auth_Audit_except_MSI.json by ConvertTo-Bylaw.
Policy 'f78ccdb4-7bf4-4106-8647-270491d2978a' {
Properties @{
DisplayName = 'Azure Data Factory linked services should use system-assigned managed identity authentication when it is supported'
Description = 'Using system-assigned managed identity when communicating with data stores via linked services avoids the use of less secured credentials such as passwords or connection strings.'
Version = '2.1.0'
Category = 'Data Factory'
PolicyVersion = '2.1.0'
Mode = 'All'
}
Parameter Effect @{
AllowedValues = @('Audit', 'Deny', 'Disabled')
Default = 'Audit'
DisplayName = 'Effect'
Description = 'Enable or disable the execution of the policy'
}
Resource 'Microsoft.DataFactory/factories/linkedservices' {
When {
Field 'Microsoft.DataFactory/factories/linkedservices/type' | Must -BeIn @('AzureSqlDatabase', 'AzureSqlMI', 'AzureSqlDW', 'AzureBlobFS', 'AdlsGen2CosmosStructuredStream', 'AzureDataLakeStore', 'AzureDataLakeStoreCosmosStructuredStream', 'AzureBlobStorage', 'AzureDatabricks')
}
Require 'typeProperties.connectionString does not contain User ID=' {
Field typeProperties.connectionString | Must -Not -ContainText 'User ID=' -IfPresent
}
Require 'typeProperties.connectionString does not contain AccountKey=' {
Field typeProperties.connectionString | Must -Not -ContainText 'AccountKey=' -IfPresent
}
Require 'AzureSqlDW.typeProperties.servicePrincipalKey does not exist' {
Field AzureSqlDW.typeProperties.servicePrincipalKey | Must -Not -Exist
}
Require 'AzureStorage.typeProperties.accountKey does not exist' {
Field AzureStorage.typeProperties.accountKey | Must -Not -Exist
}
Require 'AzureStorage.typeProperties.sasUri does not exist' {
Field AzureStorage.typeProperties.sasUri | Must -Not -Exist
}
Require 'Hubspot.typeProperties.accessToken does not exist' {
Field Hubspot.typeProperties.accessToken | Must -Not -Exist
}
Require 'typeProperties.encryptedCredential does not exist' {
Field typeProperties.encryptedCredential | Must -Not -Exist
}
Require 'AzureBlobStorage.typeProperties.credential.type does not exist' {
Field AzureBlobStorage.typeProperties.credential.type | Must -Not -Exist
}
Require 'AzureBlobFS.typeProperties.servicePrincipalCredential does not exist' {
Field AzureBlobFS.typeProperties.servicePrincipalCredential | Must -Not -Exist
}
}
Effect (Param Effect)
}Source: built-in-policies/policyDefinitions/Data Factory/LinkedService_All_Auth_Audit_except_MSI.json in Azure/azure-policy, under the MIT licence.
Bylaw