Bicep リソース定義
プロファイル/securityPolicies リソースの種類は、次をターゲットとする操作と共にデプロイできます。
-
リソース グループの - リソース グループのデプロイ コマンド 参照
各 API バージョンで変更されたプロパティの一覧については、変更ログの参照してください。
使用例
Bicep サンプル
Front Door (Standard/Premium) セキュリティ ポリシーの展開の基本的な例。
param resourceName string = 'acctest0001'
param location string = 'westeurope'
resource profile 'Microsoft.Cdn/profiles@2021-06-01' = {
name: resourceName
location: 'global'
sku: {
name: 'Premium_AzureFrontDoor'
}
properties: {
originResponseTimeoutSeconds: 120
}
}
resource securityPolicy 'Microsoft.Cdn/profiles/securityPolicies@2021-06-01' = {
name: resourceName
parent: profile
properties: {
parameters: {
associations: [
{
domains: [
{
id: customDomain.id
}
]
patternsToMatch: [
'/*'
]
}
]
type: 'WebApplicationFirewall'
wafPolicy: {
id: frontDoorWebApplicationFirewallPolicy.id
}
}
}
}
resource frontDoorWebApplicationFirewallPolicy 'Microsoft.Network/FrontDoorWebApplicationFirewallPolicies@2020-11-01' = {
name: resourceName
location: 'global'
sku: {
name: 'Premium_AzureFrontDoor'
}
properties: {
customRules: {
rules: [
{
action: 'Block'
enabledState: 'Enabled'
matchConditions: [
{
matchValue: [
'192.168.1.0/24'
'10.0.0.0/24'
]
matchVariable: 'RemoteAddr'
negateCondition: false
operator: 'IPMatch'
}
]
name: 'Rule1'
priority: 1
rateLimitDurationInMinutes: 1
rateLimitThreshold: 10
ruleType: 'MatchRule'
}
]
}
managedRules: {
managedRuleSets: [
{
ruleGroupOverrides: [
{
ruleGroupName: 'PHP'
rules: [
{
action: 'Block'
enabledState: 'Disabled'
ruleId: '933111'
}
]
}
]
ruleSetAction: 'Block'
ruleSetType: 'DefaultRuleSet'
ruleSetVersion: 'preview-0.1'
}
{
ruleSetAction: 'Block'
ruleSetType: 'BotProtection'
ruleSetVersion: 'preview-0.1'
}
]
}
policySettings: {
customBlockResponseBody: 'PGh0bWw+CjxoZWFkZXI+PHRpdGxlPkhlbGxvPC90aXRsZT48L2hlYWRlcj4KPGJvZHk+CkhlbGxvIHdvcmxkCjwvYm9keT4KPC9odG1sPg=='
customBlockResponseStatusCode: 403
enabledState: 'Enabled'
mode: 'Prevention'
redirectUrl: 'https://www.fabrikam.com'
}
}
}
resource dnsZone 'Microsoft.Network/dnsZones@2018-05-01' = {
name: '${resourceName}.com'
location: 'global'
}
resource customDomain 'Microsoft.Cdn/profiles/customDomains@2021-06-01' = {
name: resourceName
parent: profile
properties: {
azureDnsZone: {
id: dnsZone.id
}
hostName: 'fabrikam.${resourceName}.com'
tlsSettings: {
certificateType: 'ManagedCertificate'
minimumTlsVersion: 'TLS12'
}
}
}
Azure 検証済みモジュール
次の Azure 検証済みモジュール を使用して、このリソースの種類をデプロイできます。
Azure クイック スタートのサンプル
次 Azure クイック スタート テンプレート、このリソースの種類をデプロイするための Bicep サンプルが含まれています。
Microsoft.Cdn/profiles/securityPolicies リソースを作成するには、次の Bicep をテンプレートに追加します。
resource symbolicname 'Microsoft.Cdn/profiles/securityPolicies@2020-09-01' = {
parent: resourceSymbolicName
name: 'string'
properties: {
parameters: {
type: 'string'
// For remaining properties, see SecurityPolicyParameters objects
}
}
}
SecurityPolicyParameters オブジェクト
型 プロパティを設定して、オブジェクトの型を指定します。
WebApplicationFirewall の場合は、次を使用します。
{
associations: [
{
domains: [
{
id: 'string'
}
]
patternsToMatch: [
'string'
]
}
]
type: 'WebApplicationFirewall'
wafPolicy: {
id: 'string'
}
}
プロパティ値
Microsoft.Cdn/profiles/securityPolicies (英語)
| 名前 |
説明 |
価値 |
| 名前 |
リソース名 |
string (必須) |
| 親 |
Bicep では、子リソースの親リソースを指定できます。 このプロパティを追加する必要があるのは、子リソースが親リソースの外部で宣言されている場合のみです。
詳細については、「親リソースの外部 子リソース」を参照してください。 |
種類のリソースのシンボリック名: プロファイル |
| プロパティ |
セキュリティ ポリシーを作成するために必要なプロパティを含む json オブジェクト |
SecurityPolicyプロパティ |
リソースリファレンス
| 名前 |
説明 |
価値 |
| 身分証明書 |
リソース ID。 |
文字列 |
SecurityPolicyParameters (セキュリティポリシーパラメータ)
SecurityPolicyプロパティ
SecurityPolicyWebApplicationファイアウォール関連付け
| 名前 |
説明 |
価値 |
| ドメイン |
ドメインの一覧。 |
リソースリファレンス[] |
| patternsToMatch (パターン・ツー・マッチ) |
パスの一覧 |
文字列[] |
SecurityPolicyWebApplicationファイアウォールパラメータ
ARM テンプレート リソース定義
プロファイル/securityPolicies リソースの種類は、次をターゲットとする操作と共にデプロイできます。
使用例
Azure クイックスタート テンプレート
このリソースの種類 デプロイする Azure クイック スタート テンプレート 次に示します。
Microsoft.Cdn/profiles/securityPolicies リソースを作成するには、次の JSON をテンプレートに追加します。
{
"type": "Microsoft.Cdn/profiles/securityPolicies",
"apiVersion": "2020-09-01",
"name": "string",
"properties": {
"parameters": {
"type": "string"
// For remaining properties, see SecurityPolicyParameters objects
}
}
}
SecurityPolicyParameters オブジェクト
型 プロパティを設定して、オブジェクトの型を指定します。
WebApplicationFirewall の場合は、次を使用します。
{
"associations": [
{
"domains": [
{
"id": "string"
}
],
"patternsToMatch": [ "string" ]
}
],
"type": "WebApplicationFirewall",
"wafPolicy": {
"id": "string"
}
}
プロパティ値
Microsoft.Cdn/profiles/securityPolicies (英語)
| 名前 |
説明 |
価値 |
| apiVersion (英語) |
API のバージョン |
'2020-09-01' |
| 名前 |
リソース名 |
string (必須) |
| プロパティ |
セキュリティ ポリシーを作成するために必要なプロパティを含む json オブジェクト |
SecurityPolicyプロパティ |
| 型 |
リソースの種類 |
'Microsoft.Cdn/profiles/securityPolicies' |
リソースリファレンス
| 名前 |
説明 |
価値 |
| 身分証明書 |
リソース ID。 |
文字列 |
SecurityPolicyParameters (セキュリティポリシーパラメータ)
SecurityPolicyプロパティ
SecurityPolicyWebApplicationファイアウォール関連付け
| 名前 |
説明 |
価値 |
| ドメイン |
ドメインの一覧。 |
リソースリファレンス[] |
| patternsToMatch (パターン・ツー・マッチ) |
パスの一覧 |
文字列[] |
SecurityPolicyWebApplicationファイアウォールパラメータ
プロファイル/securityPolicies リソースの種類は、次をターゲットとする操作と共にデプロイできます。
-
リソースグループ 各APIバージョンの変更プロパティ一覧については、 変更ログをご覧ください。
使用例
Front Door (Standard/Premium) セキュリティ ポリシーの展開の基本的な例。
terraform {
required_providers {
azapi = {
source = "Azure/azapi"
}
}
}
provider "azapi" {
skip_provider_registration = false
}
variable "resource_name" {
type = string
default = "acctest0001"
}
variable "location" {
type = string
default = "westeurope"
}
resource "azapi_resource" "resourceGroup" {
type = "Microsoft.Resources/resourceGroups@2020-06-01"
name = var.resource_name
location = var.location
}
resource "azapi_resource" "dnsZone" {
type = "Microsoft.Network/dnsZones@2018-05-01"
parent_id = azapi_resource.resourceGroup.id
name = "${var.resource_name}.com"
location = "global"
schema_validation_enabled = false
response_export_values = ["*"]
}
resource "azapi_resource" "profile" {
type = "Microsoft.Cdn/profiles@2021-06-01"
parent_id = azapi_resource.resourceGroup.id
name = var.resource_name
location = "global"
body = {
properties = {
originResponseTimeoutSeconds = 120
}
sku = {
name = "Premium_AzureFrontDoor"
}
}
schema_validation_enabled = false
response_export_values = ["*"]
}
resource "azapi_resource" "FrontDoorWebApplicationFirewallPolicy" {
type = "Microsoft.Network/FrontDoorWebApplicationFirewallPolicies@2020-11-01"
parent_id = azapi_resource.resourceGroup.id
name = var.resource_name
location = "global"
body = {
properties = {
customRules = {
rules = [
{
action = "Block"
enabledState = "Enabled"
matchConditions = [
{
matchValue = [
"192.168.1.0/24",
"10.0.0.0/24",
]
matchVariable = "RemoteAddr"
negateCondition = false
operator = "IPMatch"
},
]
name = "Rule1"
priority = 1
rateLimitDurationInMinutes = 1
rateLimitThreshold = 10
ruleType = "MatchRule"
},
]
}
managedRules = {
managedRuleSets = [
{
ruleGroupOverrides = [
{
ruleGroupName = "PHP"
rules = [
{
action = "Block"
enabledState = "Disabled"
ruleId = "933111"
},
]
},
]
ruleSetAction = "Block"
ruleSetType = "DefaultRuleSet"
ruleSetVersion = "preview-0.1"
},
{
ruleSetAction = "Block"
ruleSetType = "BotProtection"
ruleSetVersion = "preview-0.1"
},
]
}
policySettings = {
customBlockResponseBody = "PGh0bWw+CjxoZWFkZXI+PHRpdGxlPkhlbGxvPC90aXRsZT48L2hlYWRlcj4KPGJvZHk+CkhlbGxvIHdvcmxkCjwvYm9keT4KPC9odG1sPg=="
customBlockResponseStatusCode = 403
enabledState = "Enabled"
mode = "Prevention"
redirectUrl = "https://www.fabrikam.com"
}
}
sku = {
name = "Premium_AzureFrontDoor"
}
}
schema_validation_enabled = false
response_export_values = ["*"]
}
resource "azapi_resource" "customDomain" {
type = "Microsoft.Cdn/profiles/customDomains@2021-06-01"
parent_id = azapi_resource.profile.id
name = var.resource_name
body = {
properties = {
azureDnsZone = {
id = azapi_resource.dnsZone.id
}
hostName = "fabrikam.${var.resource_name}.com"
tlsSettings = {
certificateType = "ManagedCertificate"
minimumTlsVersion = "TLS12"
}
}
}
schema_validation_enabled = false
response_export_values = ["*"]
}
resource "azapi_resource" "securityPolicy" {
type = "Microsoft.Cdn/profiles/securityPolicies@2021-06-01"
parent_id = azapi_resource.profile.id
name = var.resource_name
body = {
properties = {
parameters = {
associations = [
{
domains = [
{
id = azapi_resource.customDomain.id
},
]
patternsToMatch = [
"/*",
]
},
]
type = "WebApplicationFirewall"
wafPolicy = {
id = azapi_resource.FrontDoorWebApplicationFirewallPolicy.id
}
}
}
}
schema_validation_enabled = false
response_export_values = ["*"]
}
Microsoft.Cdn/profiles/securityPolicies リソースを作成するには、次の Terraform をテンプレートに追加します。
resource "azapi_resource" "symbolicname" {
type = "Microsoft.Cdn/profiles/securityPolicies@2020-09-01"
name = "string"
parent_id = "string"
body = {
properties = {
parameters = {
type = "string"
// For remaining properties, see SecurityPolicyParameters objects
}
}
}
}
SecurityPolicyParameters オブジェクト
型 プロパティを設定して、オブジェクトの型を指定します。
WebApplicationFirewall の場合は、次を使用します。
{
associations = [
{
domains = [
{
id = "string"
}
]
patternsToMatch = [
"string"
]
}
]
type = "WebApplicationFirewall"
wafPolicy = {
id = "string"
}
}
プロパティ値
Microsoft.Cdn/profiles/securityPolicies (英語)
| 名前 |
説明 |
価値 |
| 名前 |
リソース名 |
string (必須) |
| parent_id |
このリソースの親であるリソースの ID。 |
種類のリソースの ID: プロファイル |
| プロパティ |
セキュリティ ポリシーを作成するために必要なプロパティを含む json オブジェクト |
SecurityPolicyプロパティ |
| 型 |
リソースの種類 |
"Microsoft.Cdn/profiles/securityPolicies@2020-09-01" (英語) |
リソースリファレンス
| 名前 |
説明 |
価値 |
| 身分証明書 |
リソース ID。 |
文字列 |
SecurityPolicyParameters (セキュリティポリシーパラメータ)
SecurityPolicyプロパティ
SecurityPolicyWebApplicationファイアウォール関連付け
| 名前 |
説明 |
価値 |
| ドメイン |
ドメインの一覧。 |
リソースリファレンス[] |
| patternsToMatch (パターン・ツー・マッチ) |
パスの一覧 |
文字列[] |
SecurityPolicyWebApplicationファイアウォールパラメータ