Class VirtualNetworkRule
Allows you to add, update, or remove an Azure SQL server to a subnet of a virtual network.
Example Usage
using Pulumi;
using Azure = Pulumi.Azure;
class MyStack : Stack
{
public MyStack()
{
var example = new Azure.Core.ResourceGroup("example", new Azure.Core.ResourceGroupArgs
{
Location = "West US",
});
var vnet = new Azure.Network.VirtualNetwork("vnet", new Azure.Network.VirtualNetworkArgs
{
AddressSpaces =
{
"10.7.29.0/29",
},
Location = example.Location,
ResourceGroupName = example.Name,
});
var subnet = new Azure.Network.Subnet("subnet", new Azure.Network.SubnetArgs
{
ResourceGroupName = example.Name,
VirtualNetworkName = vnet.Name,
AddressPrefix = "10.7.29.0/29",
ServiceEndpoints =
{
"Microsoft.Sql",
},
});
var sqlserver = new Azure.Sql.SqlServer("sqlserver", new Azure.Sql.SqlServerArgs
{
ResourceGroupName = example.Name,
Location = example.Location,
Version = "12.0",
AdministratorLogin = "4dm1n157r470r",
AdministratorLoginPassword = "4-v3ry-53cr37-p455w0rd",
});
var sqlvnetrule = new Azure.Sql.VirtualNetworkRule("sqlvnetrule", new Azure.Sql.VirtualNetworkRuleArgs
{
ResourceGroupName = example.Name,
ServerName = sqlserver.Name,
SubnetId = subnet.Id,
});
}
}
Inherited Members
Namespace: Pulumi.Azure.Sql
Assembly: Pulumi.Azure.dll
Syntax
public class VirtualNetworkRule : CustomResource
Constructors
View SourceVirtualNetworkRule(String, VirtualNetworkRuleArgs, CustomResourceOptions)
Create a VirtualNetworkRule resource with the given unique name, arguments, and options.
Declaration
public VirtualNetworkRule(string name, VirtualNetworkRuleArgs args, CustomResourceOptions options = null)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | name | The unique name of the resource |
| VirtualNetworkRuleArgs | args | The arguments used to populate this resource's properties |
| CustomResourceOptions | options | A bag of options that control this resource's behavior |
Properties
View SourceIgnoreMissingVnetServiceEndpoint
Create the virtual network rule before the subnet has the virtual network service endpoint enabled. The default value is false.
Declaration
public Output<bool?> IgnoreMissingVnetServiceEndpoint { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.Nullable<System.Boolean>> |
Name
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.
Declaration
public Output<string> Name { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.String> |
ResourceGroupName
The name of the resource group where the SQL server resides. Changing this forces a new resource to be created.
Declaration
public Output<string> ResourceGroupName { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.String> |
ServerName
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.
Declaration
public Output<string> ServerName { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.String> |
SubnetId
The ID of the subnet that the SQL server will be connected to.
Declaration
public Output<string> SubnetId { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.String> |
Methods
View SourceGet(String, Input<String>, VirtualNetworkRuleState, CustomResourceOptions)
Get an existing VirtualNetworkRule resource's state with the given name, ID, and optional extra properties used to qualify the lookup.
Declaration
public static VirtualNetworkRule Get(string name, Input<string> id, VirtualNetworkRuleState state = null, CustomResourceOptions options = null)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | name | The unique name of the resulting resource. |
| Input<System.String> | id | The unique provider ID of the resource to lookup. |
| VirtualNetworkRuleState | state | Any extra arguments used during the lookup. |
| CustomResourceOptions | options | A bag of options that control this resource's behavior |
Returns
| Type | Description |
|---|---|
| VirtualNetworkRule |