Bylaw

Gallery › Media Services › Azure built-in policies

[Deprecated]: Azure Media Services should use private link

Converted Policy AuditIfNotExists Disabled Mode Indexed Version 1.1.0-deprecated Deprecated

This policy is deprecated because Media Services retirement. Learn more about policy definition deprecation at aka.ms/policydefdeprecation.

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

Azure Policy JSONPrivateLink_AINE.json · 50 lines
{
  "properties": {
    "displayName": "[Deprecated]: Azure Media Services should use private link",
    "policyType": "BuiltIn",
    "mode": "Indexed",
    "description": "This policy is deprecated because Media Services retirement. Learn more about policy definition deprecation at aka.ms/policydefdeprecation.",
    "metadata": {
      "version": "1.1.0-deprecated",
      "category": "Media Services",
      "deprecated": true
    },
    "version": "1.1.0",
    "parameters": {
      "effect": {
        "type": "String",
        "allowedValues": [
          "AuditIfNotExists",
          "Disabled"
        ],
        "defaultValue": "Disabled",
        "metadata": {
          "displayName": "Effect",
          "description": "Enable or disable the execution of the policy"
        }
      }
    },
    "policyRule": {
      "if": {
        "field": "type",
        "equals": "Microsoft.Media/mediaservices"
      },
      "then": {
        "effect": "[parameters('effect')]",
        "details": {
          "type": "Microsoft.Media/mediaservices/privateEndpointConnections",
          "existenceCondition": {
            "field": "Microsoft.Media/mediaservices/privateEndpointConnections/privateLinkServiceConnectionState.status",
            "equals": "Approved"
          }
        }
      }
    },
    "versions": [
      "1.1.0",
      "1.0.0"
    ]
  },
  "id": "/providers/Microsoft.Authorization/policyDefinitions/4a591bf5-918e-4a5f-8dad-841863140d61",
  "name": "4a591bf5-918e-4a5f-8dad-841863140d61"
}
Bylaw4a591bf5-918e-4a5f-8dad-841863140d61.bylaw.ps1 · 28 lines
# Converted from PrivateLink_AINE.json by ConvertTo-Bylaw.
Policy '4a591bf5-918e-4a5f-8dad-841863140d61' {

    Properties @{
        DisplayName   = '[Deprecated]: Azure Media Services should use private link'
        Description   = 'This policy is deprecated because Media Services retirement. Learn more about policy definition deprecation at aka.ms/policydefdeprecation.'
        Version       = '1.1.0-deprecated'
        Category      = 'Media Services'
        Deprecated    = $true
        PolicyVersion = '1.1.0'
        Mode          = 'Indexed'
    }

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

    Resource 'Microsoft.Media/mediaservices'

    AuditIfNotExists 'Microsoft.Media/mediaservices/privateEndpointConnections' -Effect (Param Effect) {
        Require 'privateLinkServiceConnectionState.status is Approved' {
            Field 'Microsoft.Media/mediaservices/privateEndpointConnections/privateLinkServiceConnectionState.status' -AllowUnknownAlias | Must -Be 'Approved'
        }
    }
}

Source: built-in-policies/policyDefinitions/Media Services/PrivateLink_AINE.json in Azure/azure-policy, under the MIT licence.