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

Bicep-resourcedefinitie

Het resourcetype servers/virtualNetworkRules kan worden geïmplementeerd met bewerkingen die zijn gericht op:

Zie logboek wijzigenvoor een lijst met gewijzigde eigenschappen in elke API-versie.

Resource-indeling

Om een Microsoft te creëren. Sql/servers/virtualNetworkRules-resource, voeg de volgende Bicep toe aan je template.

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

Eigenschapswaarden

Microsoft. SQL/servers/virtualNetworkRules

Name Description Value
name De resourcenaam tekenreeks (vereist)
parent In Bicep kun je de ouderresource voor een kindresource specificeren. U hoeft deze eigenschap alleen toe te voegen wanneer de onderliggende resource buiten de bovenliggende resource wordt gedeclareerd.

Zie onderliggende resource buiten de bovenliggende resourcevoor meer informatie.
Symbolische naam voor resource van het type: servers
properties Resource-eigenschappen. VirtualNetworkRuleProperties

VirtualNetworkRuleProperties

Name Description Value
ignoreMissingVnetServiceEndpoint Maak een firewallregel voordat vnet-service-eindpunt is ingeschakeld voor het virtuele netwerk. bool
virtualNetworkSubnetId De ARM-resource-id van het subnet van het virtuele netwerk. tekenreeks (vereist)

Gebruiksvoorbeelden

Bicep Monsters

Een eenvoudig voorbeeld van het inzetten van 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
  }
}

Resourcedefinitie van ARM-sjabloon

Het resourcetype servers/virtualNetworkRules kan worden geïmplementeerd met bewerkingen die zijn gericht op:

Zie logboek wijzigenvoor een lijst met gewijzigde eigenschappen in elke API-versie.

Resource-indeling

Om een Microsoft te creëren. Sql/servers/virtualNetworkRules-resource, voeg de volgende JSON toe aan je sjabloon.

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

Eigenschapswaarden

Microsoft. SQL/servers/virtualNetworkRules

Name Description Value
apiVersion De API-versie '2021-11-01-preview'
name De resourcenaam tekenreeks (vereist)
properties Resource-eigenschappen. VirtualNetworkRuleProperties
type Het brontype 'Microsoft. SQL/servers/virtualNetworkRules'

VirtualNetworkRuleProperties

Name Description Value
ignoreMissingVnetServiceEndpoint Maak een firewallregel voordat vnet-service-eindpunt is ingeschakeld voor het virtuele netwerk. bool
virtualNetworkSubnetId De ARM-resource-id van het subnet van het virtuele netwerk. tekenreeks (vereist)

Gebruiksvoorbeelden

Resourcedefinitie van Terraform (AzAPI-provider)

Het resourcetype servers/virtualNetworkRules kan worden geïmplementeerd met bewerkingen die zijn gericht op:

  • Resourcegroepen

Zie logboek wijzigenvoor een lijst met gewijzigde eigenschappen in elke API-versie.

Resource-indeling

Om een Microsoft te creëren. Sql/servers/virtualNetworkRules-resource, voeg de volgende Terraform toe aan je template.

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

Eigenschapswaarden

Microsoft. SQL/servers/virtualNetworkRules

Name Description Value
name De resourcenaam tekenreeks (vereist)
parent_id De id van de resource die het bovenliggende item voor deze resource is. Id voor resource van het type: servers
properties Resource-eigenschappen. VirtualNetworkRuleProperties
type Het brontype "Microsoft. Sql/servers/virtualNetworkRules@2021-11-01-preview"

VirtualNetworkRuleProperties

Name Description Value
ignoreMissingVnetServiceEndpoint Maak een firewallregel voordat vnet-service-eindpunt is ingeschakeld voor het virtuele netwerk. bool
virtualNetworkSubnetId De ARM-resource-id van het subnet van het virtuele netwerk. tekenreeks (vereist)

Gebruiksvoorbeelden

Terraform-monsters

Een eenvoudig voorbeeld van het inzetten van 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    = ["*"]
}