VirtualNetworkRuleArgs

data class VirtualNetworkRuleArgs(val ignoreMissingVnetServiceEndpoint: Output<Boolean>? = null, val name: Output<String>? = null, val resourceGroupName: Output<String>? = null, val serverName: Output<String>? = null, val subnetId: Output<String>? = null) : ConvertibleToJava<VirtualNetworkRuleArgs>

Allows you to add, update, or remove an Azure SQL server to a subnet of a virtual network.

Note: The azure.sql.VirtualNetworkRule resource is deprecated in version 3.0 of the AzureRM provider and will be removed in version 4.0. Please use the azure.mssql.VirtualNetworkRule resource instead.

Example Usage

package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.azure.core.ResourceGroup;
import com.pulumi.azure.core.ResourceGroupArgs;
import com.pulumi.azure.network.VirtualNetwork;
import com.pulumi.azure.network.VirtualNetworkArgs;
import com.pulumi.azure.network.Subnet;
import com.pulumi.azure.network.SubnetArgs;
import com.pulumi.azure.sql.SqlServer;
import com.pulumi.azure.sql.SqlServerArgs;
import com.pulumi.azure.sql.VirtualNetworkRule;
import com.pulumi.azure.sql.VirtualNetworkRuleArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;
public class App {
public static void main(String[] args) {
Pulumi.run(App::stack);
}
public static void stack(Context ctx) {
var example = new ResourceGroup("example", ResourceGroupArgs.builder()
.name("example-sql-server-vnet-rule")
.location("West Europe")
.build());
var vnet = new VirtualNetwork("vnet", VirtualNetworkArgs.builder()
.name("example-vnet")
.addressSpaces("10.7.29.0/29")
.location(example.location())
.resourceGroupName(example.name())
.build());
var subnet = new Subnet("subnet", SubnetArgs.builder()
.name("example-subnet")
.resourceGroupName(example.name())
.virtualNetworkName(vnet.name())
.addressPrefixes("10.7.29.0/29")
.serviceEndpoints("Microsoft.Sql")
.build());
var sqlserver = new SqlServer("sqlserver", SqlServerArgs.builder()
.name("uniqueazuresqlserver")
.resourceGroupName(example.name())
.location(example.location())
.version("12.0")
.administratorLogin("4dm1n157r470r")
.administratorLoginPassword("4-v3ry-53cr37-p455w0rd")
.build());
var sqlvnetrule = new VirtualNetworkRule("sqlvnetrule", VirtualNetworkRuleArgs.builder()
.name("sql-vnet-rule")
.resourceGroupName(example.name())
.serverName(sqlserver.name())
.subnetId(subnet.id())
.build());
}
}

Import

SQL Virtual Network Rules can be imported using the resource id, e.g.

$ pulumi import azure:sql/virtualNetworkRule:VirtualNetworkRule rule1 /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myresourcegroup/providers/Microsoft.Sql/servers/myserver/virtualNetworkRules/vnetrulename

Constructors

Link copied to clipboard
fun VirtualNetworkRuleArgs(ignoreMissingVnetServiceEndpoint: Output<Boolean>? = null, name: Output<String>? = null, resourceGroupName: Output<String>? = null, serverName: Output<String>? = null, subnetId: Output<String>? = null)

Functions

Link copied to clipboard
open override fun toJava(): VirtualNetworkRuleArgs

Properties

Link copied to clipboard

Create the virtual network rule before the subnet has the virtual network service endpoint enabled. The default value is false.

Link copied to clipboard
val name: Output<String>? = null

The name of the SQL virtual network rule. Changing this forces a new resource to be created. Cannot be empty and must only contain alphanumeric characters and hyphens. Cannot start with a number, and cannot start or end with a hyphen.

Link copied to clipboard
val resourceGroupName: Output<String>? = null

The name of the resource group where the SQL server resides. Changing this forces a new resource to be created.

Link copied to clipboard
val serverName: Output<String>? = null

The name of the SQL Server to which this SQL virtual network rule will be applied to. Changing this forces a new resource to be created.

Link copied to clipboard
val subnetId: Output<String>? = null

The ID of the subnet that the SQL server will be connected to.