VirtualNetworkRule

class VirtualNetworkRule : KotlinCustomResource

Allows you to manage rules for allowing traffic between an Azure SQL server and a subnet of a virtual network.

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.mssql.Server;
import com.pulumi.azure.mssql.ServerArgs;
import com.pulumi.azure.mssql.VirtualNetworkRule;
import com.pulumi.azure.mssql.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 exampleVirtualNetwork = new VirtualNetwork("exampleVirtualNetwork", VirtualNetworkArgs.builder()
.name("example-vnet")
.addressSpaces("10.7.29.0/29")
.location(example.location())
.resourceGroupName(example.name())
.build());
var exampleSubnet = new Subnet("exampleSubnet", SubnetArgs.builder()
.name("example-subnet")
.resourceGroupName(example.name())
.virtualNetworkName(exampleVirtualNetwork.name())
.addressPrefixes("10.7.29.0/29")
.serviceEndpoints("Microsoft.Sql")
.build());
var exampleServer = new Server("exampleServer", ServerArgs.builder()
.name("uniqueazuresqlserver")
.resourceGroupName(example.name())
.location(example.location())
.version("12.0")
.administratorLogin("4dm1n157r470r")
.administratorLoginPassword("4-v3ry-53cr37-p455w0rd")
.build());
var exampleVirtualNetworkRule = new VirtualNetworkRule("exampleVirtualNetworkRule", VirtualNetworkRuleArgs.builder()
.name("sql-vnet-rule")
.serverId(exampleServer.id())
.subnetId(exampleSubnet.id())
.build());
}
}

Import

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

$ pulumi import azure:mssql/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. Defaults to 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.

Link copied to clipboard
val pulumiChildResources: Set<KotlinResource>
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
val serverId: Output<String>

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

Link copied to clipboard
val subnetId: Output<String>

The ID of the subnet from which the SQL server will accept communications.

Link copied to clipboard
val urn: Output<String>