VirtualNetworkRule

class VirtualNetworkRule : KotlinCustomResource

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

Properties

Link copied to clipboard
val id: Output<String>
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>

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 pulumiChildResources: Set<KotlinResource>
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard

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>

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>

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

Link copied to clipboard
val urn: Output<String>