Bylaw

Gallery › Managed Identity › Azure built-in policies

[Preview]: [Preview]: Managed Identity Federated Credentials should be of approved types from approved federation sources

Converted Initiative Version 1.0.0-preview Preview

Control use of federated credentials for Managed Identities. This initiative incudes policies to block federated identity credentials altogether, to limit use to specific federation provider types, and to limit federation reationships to approved sources.

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

Azure Policy JSONFIC_LimitIssuers.json · 199 lines
{
  "properties": {
    "displayName": "[Preview]: [Preview]: Managed Identity Federated Credentials should be of approved types from approved federation sources",
    "policyType": "BuiltIn",
    "description": "Control use of federated credentials for Managed Identities. This initiative incudes policies to block federated identity credentials altogether, to limit use to specific federation provider types, and to limit federation reationships to approved sources.",
    "metadata": {
      "version": "1.0.0-preview",
      "category": "Managed Identity",
      "preview": true
    },
    "version": "1.0.0-preview",
    "parameters": {
      "allowFederatedCredentials": {
        "type": "boolean",
        "metadata": {
          "displayName": "Allow Federated Credentials",
          "description": "Set this value to true to allow Federated Credentials to be configured on Azure Managed Identities.",
          "portalReview": true
        },
        "defaultValue": false
      },
      "allowAKS": {
        "type": "boolean",
        "metadata": {
          "displayName": "Allow AKS",
          "description": "Set this value to true to allow Azure Managed Identities federation with Azure Kubernetes Service Clusters.",
          "portalReview": true
        },
        "defaultValue": false
      },
      "allowGitHub": {
        "type": "boolean",
        "metadata": {
          "displayName": "Allow GitHub",
          "description": "Set this value to true to allow Azure Managed Identities federation with GitHub Actions.",
          "portalReview": true
        },
        "defaultValue": false
      },
      "allowAWS": {
        "type": "boolean",
        "metadata": {
          "displayName": "Allow AWS",
          "description": "Set this value to true to allow Azure Managed Identities federation with Amazon Web Services resources.",
          "portalReview": true
        },
        "defaultValue": false
      },
      "allowGCS": {
        "type": "boolean",
        "metadata": {
          "displayName": "Allow GCS",
          "description": "Set this value to true to allow Azure Managed Identities federation with Google Cloud resources.",
          "portalReview": true
        },
        "defaultValue": false
      },
      "allowedIssuerExceptions": {
        "type": "array",
        "metadata": {
          "displayName": "Allowed Issuer Exceptions",
          "description": "The list of specific issuers allowed.",
          "portalReview": true
        },
        "defaultValue": []
      },
      "allowedAKSTenants": {
        "type": "array",
        "metadata": {
          "displayName": "Allowed AKS cluster tenants",
          "description": "The list of allowed Azure AD tenant ID's of AKS OIDC issuers. Empty to allow all tenants.",
          "portalReview": true
        },
        "defaultValue": []
      },
      "allowedAKSLocations": {
        "type": "array",
        "metadata": {
          "displayName": "Allowed AKS cluster locations",
          "description": "The list of allowed locations for AKS OIDC issuers. Empty to allow any location.",
          "strongType": "location",
          "portalReview": true
        },
        "defaultValue": []
      },
      "allowedAKSClusterExceptions": {
        "type": "array",
        "metadata": {
          "displayName": "Allowed AKS Cluster Exceptions",
          "description": "The list of specific cluster ids that will be exceptions to the location and tenant rules.",
          "portalReview": true
        },
        "defaultValue": []
      },
      "allowedGitHubRepoOwners": {
        "type": "array",
        "metadata": {
          "displayName": "Allowed GitHub Repo Owners",
          "description": "The list of allowed owners. Empty to allow all owners.",
          "portalReview": true
        },
        "defaultValue": []
      },
      "allowedGitHubRepoExceptions": {
        "type": "array",
        "metadata": {
          "displayName": "Allowed GitHub Repo Exceptions",
          "description": "The list of specific repo names (including owner) that are exempt from the above repo ownership rules.",
          "portalReview": true
        },
        "defaultValue": []
      },
      "effect": {
        "type": "string",
        "metadata": {
          "displayName": "Effect",
          "description": "Enable or disable the execution of the policy.",
          "portalReview": true
        },
        "allowedValues": [
          "Audit",
          "Disabled",
          "Deny"
        ],
        "defaultValue": "Audit"
      }
    },
    "policyDefinitions": [
      {
        "policyDefinitionReferenceId": "2571b7c3-3056-4a61-b00a-9bc5232234f5",
        "policyDefinitionId": "/providers/Microsoft.Authorization/policyDefinitions/2571b7c3-3056-4a61-b00a-9bc5232234f5",
        "definitionVersion": "1.*.*-preview",
        "parameters": {
          "allowFederatedCredentials": {
            "value": "[parameters('allowFederatedCredentials')]"
          },
          "allowAKS": {
            "value": "[parameters('allowAKS')]"
          },
          "allowGitHub": {
            "value": "[parameters('allowGitHub')]"
          },
          "allowAWS": {
            "value": "[parameters('allowAWS')]"
          },
          "allowGCS": {
            "value": "[parameters('allowGCS')]"
          },
          "allowedIssuerExceptions": {
            "value": "[parameters('allowedIssuerExceptions')]"
          },
          "effect": {
            "value": "[parameters('effect')]"
          }
        }
      },
      {
        "policyDefinitionReferenceId": "ae62c456-33de-4dc8-b100-7ce9028a7d99",
        "policyDefinitionId": "/providers/Microsoft.Authorization/policyDefinitions/ae62c456-33de-4dc8-b100-7ce9028a7d99",
        "definitionVersion": "1.*.*-preview",
        "parameters": {
          "allowedTenants": {
            "value": "[parameters('allowedAKSTenants')]"
          },
          "allowedLocations": {
            "value": "[parameters('allowedAKSLocations')]"
          },
          "allowedClusterExceptions": {
            "value": "[parameters('allowedAKSClusterExceptions')]"
          },
          "effect": {
            "value": "[parameters('effect')]"
          }
        }
      },
      {
        "policyDefinitionReferenceId": "fd1a8e20-2c4f-4a6c-9354-b58d786d9a1f",
        "policyDefinitionId": "/providers/Microsoft.Authorization/policyDefinitions/fd1a8e20-2c4f-4a6c-9354-b58d786d9a1f",
        "definitionVersion": "1.*.*-preview",
        "parameters": {
          "allowedRepoOwners": {
            "value": "[parameters('allowedGitHubRepoOwners')]"
          },
          "allowedRepoExceptions": {
            "value": "[parameters('allowedGitHubRepoExceptions')]"
          },
          "effect": {
            "value": "[parameters('effect')]"
          }
        }
      }
    ],
    "versions": [
      "1.0.0-PREVIEW"
    ]
  },
  "id": "/providers/Microsoft.Authorization/policySetDefinitions/5e4ee281-95a3-442a-bb2a-5ef68cf5181a",
  "name": "5e4ee281-95a3-442a-bb2a-5ef68cf5181a"
}
Bylaw5e4ee281-95a3-442a-bb2a-5ef68cf5181a.bylaw.ps1 · 136 lines
# Converted from FIC_LimitIssuers.json by ConvertTo-Bylaw.
Initiative '5e4ee281-95a3-442a-bb2a-5ef68cf5181a' {

    Properties @{
        DisplayName   = '[Preview]: [Preview]: Managed Identity Federated Credentials should be of approved types from approved federation sources'
        Description   = 'Control use of federated credentials for Managed Identities. This initiative incudes policies to block federated identity credentials altogether, to limit use to specific federation provider types, and to limit federation reationships to approved sources.'
        Version       = '1.0.0-preview'
        Category      = 'Managed Identity'
        Preview       = $true
        PolicyVersion = '1.0.0-preview'
    }

    Parameter AllowFederatedCredentials @{
        Type        = 'boolean'
        Default     = $false
        DisplayName = 'Allow Federated Credentials'
        Description = 'Set this value to true to allow Federated Credentials to be configured on Azure Managed Identities.'
        Metadata    = [ordered]@{ portalReview = $true }
    }
    Parameter AllowAKS @{
        Type        = 'boolean'
        Default     = $false
        DisplayName = 'Allow AKS'
        Description = 'Set this value to true to allow Azure Managed Identities federation with Azure Kubernetes Service Clusters.'
        Metadata    = [ordered]@{ portalReview = $true }
    }
    Parameter AllowGitHub @{
        Type        = 'boolean'
        Default     = $false
        DisplayName = 'Allow GitHub'
        Description = 'Set this value to true to allow Azure Managed Identities federation with GitHub Actions.'
        Metadata    = [ordered]@{ portalReview = $true }
    }
    Parameter AllowAWS @{
        Type        = 'boolean'
        Default     = $false
        DisplayName = 'Allow AWS'
        Description = 'Set this value to true to allow Azure Managed Identities federation with Amazon Web Services resources.'
        Metadata    = [ordered]@{ portalReview = $true }
    }
    Parameter AllowGCS @{
        Type        = 'boolean'
        Default     = $false
        DisplayName = 'Allow GCS'
        Description = 'Set this value to true to allow Azure Managed Identities federation with Google Cloud resources.'
        Metadata    = [ordered]@{ portalReview = $true }
    }
    Parameter AllowedIssuerExceptions @{
        Type        = 'array'
        Default     = @()
        DisplayName = 'Allowed Issuer Exceptions'
        Description = 'The list of specific issuers allowed.'
        Metadata    = [ordered]@{ portalReview = $true }
    }
    Parameter AllowedAKSTenants @{
        Type        = 'array'
        Default     = @()
        DisplayName = 'Allowed AKS cluster tenants'
        Description = 'The list of allowed Azure AD tenant ID''s of AKS OIDC issuers. Empty to allow all tenants.'
        Metadata    = [ordered]@{ portalReview = $true }
    }
    Parameter AllowedAKSLocations @{
        Type        = 'array'
        Default     = @()
        DisplayName = 'Allowed AKS cluster locations'
        Description = 'The list of allowed locations for AKS OIDC issuers. Empty to allow any location.'
        Metadata    = [ordered]@{ strongType = 'location'; portalReview = $true }
    }
    Parameter AllowedAKSClusterExceptions @{
        Type        = 'array'
        Default     = @()
        DisplayName = 'Allowed AKS Cluster Exceptions'
        Description = 'The list of specific cluster ids that will be exceptions to the location and tenant rules.'
        Metadata    = [ordered]@{ portalReview = $true }
    }
    Parameter AllowedGitHubRepoOwners @{
        Type        = 'array'
        Default     = @()
        DisplayName = 'Allowed GitHub Repo Owners'
        Description = 'The list of allowed owners. Empty to allow all owners.'
        Metadata    = [ordered]@{ portalReview = $true }
    }
    Parameter AllowedGitHubRepoExceptions @{
        Type        = 'array'
        Default     = @()
        DisplayName = 'Allowed GitHub Repo Exceptions'
        Description = 'The list of specific repo names (including owner) that are exempt from the above repo ownership rules.'
        Metadata    = [ordered]@{ portalReview = $true }
    }
    Parameter Effect @{
        Type          = 'string'
        AllowedValues = @('Audit', 'Disabled', 'Deny')
        Default       = 'Audit'
        DisplayName   = 'Effect'
        Description   = 'Enable or disable the execution of the policy.'
        Metadata      = [ordered]@{ portalReview = $true }
    }

    PolicyDefinition @{
        Id          = '2571b7c3-3056-4a61-b00a-9bc5232234f5'
        ReferenceId = '2571b7c3-3056-4a61-b00a-9bc5232234f5'
        Version     = '1.*.*-preview'
        Parameters  = [ordered]@{
            allowFederatedCredentials = (Param AllowFederatedCredentials)
            allowAKS                  = (Param AllowAKS)
            allowGitHub               = (Param AllowGitHub)
            allowAWS                  = (Param AllowAWS)
            allowGCS                  = (Param AllowGCS)
            allowedIssuerExceptions   = (Param AllowedIssuerExceptions)
            effect                    = (Param Effect)
        }
    }

    PolicyDefinition @{
        Id          = 'ae62c456-33de-4dc8-b100-7ce9028a7d99'
        ReferenceId = 'ae62c456-33de-4dc8-b100-7ce9028a7d99'
        Version     = '1.*.*-preview'
        Parameters  = [ordered]@{
            allowedTenants           = (Param AllowedAKSTenants)
            allowedLocations         = (Param AllowedAKSLocations)
            allowedClusterExceptions = (Param AllowedAKSClusterExceptions)
            effect                   = (Param Effect)
        }
    }

    PolicyDefinition @{
        Id          = 'fd1a8e20-2c4f-4a6c-9354-b58d786d9a1f'
        ReferenceId = 'fd1a8e20-2c4f-4a6c-9354-b58d786d9a1f'
        Version     = '1.*.*-preview'
        Parameters  = [ordered]@{
            allowedRepoOwners     = (Param AllowedGitHubRepoOwners)
            allowedRepoExceptions = (Param AllowedGitHubRepoExceptions)
            effect                = (Param Effect)
        }
    }
}

Members (3)

Source: built-in-policies/policySetDefinitions/Managed Identity/FIC_LimitIssuers.json in Azure/azure-policy, under the MIT licence.