Microsoft. SQL servers/virtualNetworkRules 2021-02-01-preview

Bicep-resursdefinition

Resurstypen servrar/virtualNetworkRules kan distribueras med åtgärder som mål:

En lista över ändrade egenskaper i varje API-version finns i ändringsloggen.

Resursformat

För att skapa en Microsoft. SQL/servers/virtualNetworkRules-resurs, lägg till följande Bicep i din mall.

resource symbolicname 'Microsoft.Sql/servers/virtualNetworkRules@2021-02-01-preview' = {
  parent: resourceSymbolicName
  name: 'string'
  properties: {
    ignoreMissingVnetServiceEndpoint: bool
    virtualNetworkSubnetId: 'string'
  }
}

Egenskapsvärden

Microsoft. SQL/servrar/virtualNetworkRules

Name Description Value
name Resursnamnet sträng (krävs)
parent I Bicep kan du ange föräldraresursen för en barnresurs. Du behöver bara lägga till den här egenskapen när den underordnade resursen deklareras utanför den överordnade resursen.

Mer information finns i Underordnad resurs utanför den överordnade resursen.
Symboliskt namn för resurs av typen: servrar
properties Resursegenskaper. VirtualNetworkRuleProperties

VirtualNetworkRuleProperties

Name Description Value
ignoreMissingVnetServiceEndpoint Skapa brandväggsregel innan vnet-tjänstslutpunkten är aktiverad i det virtuella nätverket. bool
virtualNetworkSubnetId ARM-resurs-ID för det virtuella nätverkets undernät. sträng (krävs)

Användningsexempel

Bicep-prover

Ett grundläggande exempel på att införa Azure SQL Virtual Network regel.

param resourceName string = 'acctest0001'
param location string = 'westeurope'
@secure()
@description('The administrator password for the SQL server')
param sqlAdministratorPassword string

resource server 'Microsoft.Sql/servers@2021-02-01-preview' = {
  name: resourceName
  location: location
  properties: {
    administratorLogin: 'missadmin'
    administratorLoginPassword: null
    minimalTlsVersion: '1.2'
    publicNetworkAccess: 'Enabled'
    restrictOutboundNetworkAccess: 'Disabled'
    version: '12.0'
  }
}

resource virtualNetwork 'Microsoft.Network/virtualNetworks@2022-07-01' = {
  name: resourceName
  location: location
  properties: {
    addressSpace: {
      addressPrefixes: [
        '10.7.28.0/23'
      ]
    }
    dhcpOptions: {
      dnsServers: []
    }
    subnets: []
  }
}

resource subnet 'Microsoft.Network/virtualNetworks/subnets@2022-07-01' = {
  parent: virtualNetwork
  name: resourceName
  properties: {
    addressPrefix: '10.7.28.0/25'
    delegations: []
    privateEndpointNetworkPolicies: 'Enabled'
    privateLinkServiceNetworkPolicies: 'Enabled'
    serviceEndpointPolicies: []
    serviceEndpoints: [
      {
        service: 'Microsoft.Sql'
      }
    ]
  }
}

resource virtualNetworkRule 'Microsoft.Sql/servers/virtualNetworkRules@2020-11-01-preview' = {
  parent: server
  name: resourceName
  properties: {
    ignoreMissingVnetServiceEndpoint: false
    virtualNetworkSubnetId: subnet.id
  }
}

Resursdefinition för ARM-mall

Resurstypen servrar/virtualNetworkRules kan distribueras med åtgärder som mål:

En lista över ändrade egenskaper i varje API-version finns i ändringsloggen.

Resursformat

För att skapa en Microsoft. SQL/servers/virtualNetworkRules-resurs, lägg till följande JSON i din mall.

{
  "type": "Microsoft.Sql/servers/virtualNetworkRules",
  "apiVersion": "2021-02-01-preview",
  "name": "string",
  "properties": {
    "ignoreMissingVnetServiceEndpoint": "bool",
    "virtualNetworkSubnetId": "string"
  }
}

Egenskapsvärden

Microsoft. SQL/servrar/virtualNetworkRules

Name Description Value
apiVersion API-versionen '2021-02-01-preview'
name Resursnamnet sträng (krävs)
properties Resursegenskaper. VirtualNetworkRuleProperties
type Resurstypen 'Microsoft. SQL/servrar/virtualNetworkRules'

VirtualNetworkRuleProperties

Name Description Value
ignoreMissingVnetServiceEndpoint Skapa brandväggsregel innan vnet-tjänstslutpunkten är aktiverad i det virtuella nätverket. bool
virtualNetworkSubnetId ARM-resurs-ID för det virtuella nätverkets undernät. sträng (krävs)

Användningsexempel

Resursdefinition för Terraform (AzAPI-provider)

Resurstypen servrar/virtualNetworkRules kan distribueras med åtgärder som mål:

  • Resursgrupper

En lista över ändrade egenskaper i varje API-version finns i ändringsloggen.

Resursformat

För att skapa en Microsoft. SQL/servers/virtualNetworkRules-resurs, lägg till följande Terraform i din mall.

resource "azapi_resource" "symbolicname" {
  type = "Microsoft.Sql/servers/virtualNetworkRules@2021-02-01-preview"
  name = "string"
  parent_id = "string"
  body = {
    properties = {
      ignoreMissingVnetServiceEndpoint = bool
      virtualNetworkSubnetId = "string"
    }
  }
}

Egenskapsvärden

Microsoft. SQL/servrar/virtualNetworkRules

Name Description Value
name Resursnamnet sträng (krävs)
parent_id ID för resursen som är överordnad för den här resursen. ID för resurs av typen: servrar
properties Resursegenskaper. VirtualNetworkRuleProperties
type Resurstypen "Microsoft. Sql/servers/virtualNetworkRules@2021-02-01-preview"

VirtualNetworkRuleProperties

Name Description Value
ignoreMissingVnetServiceEndpoint Skapa brandväggsregel innan vnet-tjänstslutpunkten är aktiverad i det virtuella nätverket. bool
virtualNetworkSubnetId ARM-resurs-ID för det virtuella nätverkets undernät. sträng (krävs)

Användningsexempel

Terraform-exempel

Ett grundläggande exempel på att införa Azure SQL Virtual Network regel.

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"
}

variable "sql_administrator_password" {
  type        = string
  description = "The administrator password for the SQL server"
  sensitive   = true
}

resource "azapi_resource" "resourceGroup" {
  type     = "Microsoft.Resources/resourceGroups@2020-06-01"
  name     = var.resource_name
  location = var.location
}

resource "azapi_resource" "server" {
  type      = "Microsoft.Sql/servers@2021-02-01-preview"
  parent_id = azapi_resource.resourceGroup.id
  name      = var.resource_name
  location  = var.location
  body = {
    properties = {
      administratorLogin            = "missadmin"
      administratorLoginPassword    = var.sql_administrator_password
      minimalTlsVersion             = "1.2"
      publicNetworkAccess           = "Enabled"
      restrictOutboundNetworkAccess = "Disabled"
      version                       = "12.0"
    }
  }
  schema_validation_enabled = false
  response_export_values    = ["*"]
}

resource "azapi_resource" "virtualNetwork" {
  type      = "Microsoft.Network/virtualNetworks@2022-07-01"
  parent_id = azapi_resource.resourceGroup.id
  name      = var.resource_name
  location  = var.location
  body = {
    properties = {
      addressSpace = {
        addressPrefixes = [
          "10.7.28.0/23",
        ]
      }
      dhcpOptions = {
        dnsServers = [
        ]
      }
      subnets = [
      ]
    }
  }
  schema_validation_enabled = false
  response_export_values    = ["*"]
  lifecycle {
    ignore_changes = [body.properties.subnets]
  }
}

resource "azapi_resource" "subnet" {
  type      = "Microsoft.Network/virtualNetworks/subnets@2022-07-01"
  parent_id = azapi_resource.virtualNetwork.id
  name      = var.resource_name
  body = {
    properties = {
      addressPrefix = "10.7.28.0/25"
      delegations = [
      ]
      privateEndpointNetworkPolicies    = "Enabled"
      privateLinkServiceNetworkPolicies = "Enabled"
      serviceEndpointPolicies = [
      ]
      serviceEndpoints = [
        {
          service = "Microsoft.Sql"
        },
      ]
    }
  }
  schema_validation_enabled = false
  response_export_values    = ["*"]
}

resource "azapi_resource" "virtualNetworkRule" {
  type      = "Microsoft.Sql/servers/virtualNetworkRules@2020-11-01-preview"
  parent_id = azapi_resource.server.id
  name      = var.resource_name
  body = {
    properties = {
      ignoreMissingVnetServiceEndpoint = false
      virtualNetworkSubnetId           = azapi_resource.subnet.id
    }
  }
  schema_validation_enabled = false
  response_export_values    = ["*"]
}