1. Packages
  2. Azure Classic
  3. API Docs
  4. network
  5. VirtualNetworkDnsServers

We recommend using Azure Native.

Azure Classic v5.80.0 published on Monday, Jun 10, 2024 by Pulumi

azure.network.VirtualNetworkDnsServers

Explore with Pulumi AI

azure logo

We recommend using Azure Native.

Azure Classic v5.80.0 published on Monday, Jun 10, 2024 by Pulumi

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as azure from "@pulumi/azure";
    
    const example = new azure.core.ResourceGroup("example", {
        name: "example-resources",
        location: "West Europe",
    });
    const exampleVirtualNetwork = new azure.network.VirtualNetwork("example", {
        name: "example-vnet",
        addressSpaces: ["10.0.0.0/16"],
        location: example.location,
        resourceGroupName: example.name,
        subnets: [{
            name: "subnet1",
            addressPrefix: "10.0.1.0/24",
        }],
    });
    const exampleVirtualNetworkDnsServers = new azure.network.VirtualNetworkDnsServers("example", {
        virtualNetworkId: exampleVirtualNetwork.id,
        dnsServers: [
            "10.7.7.2",
            "10.7.7.7",
            "10.7.7.1",
        ],
    });
    
    import pulumi
    import pulumi_azure as azure
    
    example = azure.core.ResourceGroup("example",
        name="example-resources",
        location="West Europe")
    example_virtual_network = azure.network.VirtualNetwork("example",
        name="example-vnet",
        address_spaces=["10.0.0.0/16"],
        location=example.location,
        resource_group_name=example.name,
        subnets=[azure.network.VirtualNetworkSubnetArgs(
            name="subnet1",
            address_prefix="10.0.1.0/24",
        )])
    example_virtual_network_dns_servers = azure.network.VirtualNetworkDnsServers("example",
        virtual_network_id=example_virtual_network.id,
        dns_servers=[
            "10.7.7.2",
            "10.7.7.7",
            "10.7.7.1",
        ])
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-azure/sdk/v5/go/azure/core"
    	"github.com/pulumi/pulumi-azure/sdk/v5/go/azure/network"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		example, err := core.NewResourceGroup(ctx, "example", &core.ResourceGroupArgs{
    			Name:     pulumi.String("example-resources"),
    			Location: pulumi.String("West Europe"),
    		})
    		if err != nil {
    			return err
    		}
    		exampleVirtualNetwork, err := network.NewVirtualNetwork(ctx, "example", &network.VirtualNetworkArgs{
    			Name: pulumi.String("example-vnet"),
    			AddressSpaces: pulumi.StringArray{
    				pulumi.String("10.0.0.0/16"),
    			},
    			Location:          example.Location,
    			ResourceGroupName: example.Name,
    			Subnets: network.VirtualNetworkSubnetArray{
    				&network.VirtualNetworkSubnetArgs{
    					Name:          pulumi.String("subnet1"),
    					AddressPrefix: pulumi.String("10.0.1.0/24"),
    				},
    			},
    		})
    		if err != nil {
    			return err
    		}
    		_, err = network.NewVirtualNetworkDnsServers(ctx, "example", &network.VirtualNetworkDnsServersArgs{
    			VirtualNetworkId: exampleVirtualNetwork.ID(),
    			DnsServers: pulumi.StringArray{
    				pulumi.String("10.7.7.2"),
    				pulumi.String("10.7.7.7"),
    				pulumi.String("10.7.7.1"),
    			},
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Azure = Pulumi.Azure;
    
    return await Deployment.RunAsync(() => 
    {
        var example = new Azure.Core.ResourceGroup("example", new()
        {
            Name = "example-resources",
            Location = "West Europe",
        });
    
        var exampleVirtualNetwork = new Azure.Network.VirtualNetwork("example", new()
        {
            Name = "example-vnet",
            AddressSpaces = new[]
            {
                "10.0.0.0/16",
            },
            Location = example.Location,
            ResourceGroupName = example.Name,
            Subnets = new[]
            {
                new Azure.Network.Inputs.VirtualNetworkSubnetArgs
                {
                    Name = "subnet1",
                    AddressPrefix = "10.0.1.0/24",
                },
            },
        });
    
        var exampleVirtualNetworkDnsServers = new Azure.Network.VirtualNetworkDnsServers("example", new()
        {
            VirtualNetworkId = exampleVirtualNetwork.Id,
            DnsServers = new[]
            {
                "10.7.7.2",
                "10.7.7.7",
                "10.7.7.1",
            },
        });
    
    });
    
    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.inputs.VirtualNetworkSubnetArgs;
    import com.pulumi.azure.network.VirtualNetworkDnsServers;
    import com.pulumi.azure.network.VirtualNetworkDnsServersArgs;
    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-resources")
                .location("West Europe")
                .build());
    
            var exampleVirtualNetwork = new VirtualNetwork("exampleVirtualNetwork", VirtualNetworkArgs.builder()
                .name("example-vnet")
                .addressSpaces("10.0.0.0/16")
                .location(example.location())
                .resourceGroupName(example.name())
                .subnets(VirtualNetworkSubnetArgs.builder()
                    .name("subnet1")
                    .addressPrefix("10.0.1.0/24")
                    .build())
                .build());
    
            var exampleVirtualNetworkDnsServers = new VirtualNetworkDnsServers("exampleVirtualNetworkDnsServers", VirtualNetworkDnsServersArgs.builder()
                .virtualNetworkId(exampleVirtualNetwork.id())
                .dnsServers(            
                    "10.7.7.2",
                    "10.7.7.7",
                    "10.7.7.1")
                .build());
    
        }
    }
    
    resources:
      example:
        type: azure:core:ResourceGroup
        properties:
          name: example-resources
          location: West Europe
      exampleVirtualNetwork:
        type: azure:network:VirtualNetwork
        name: example
        properties:
          name: example-vnet
          addressSpaces:
            - 10.0.0.0/16
          location: ${example.location}
          resourceGroupName: ${example.name}
          subnets:
            - name: subnet1
              addressPrefix: 10.0.1.0/24
      exampleVirtualNetworkDnsServers:
        type: azure:network:VirtualNetworkDnsServers
        name: example
        properties:
          virtualNetworkId: ${exampleVirtualNetwork.id}
          dnsServers:
            - 10.7.7.2
            - 10.7.7.7
            - 10.7.7.1
    

    Create VirtualNetworkDnsServers Resource

    Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.

    Constructor syntax

    new VirtualNetworkDnsServers(name: string, args: VirtualNetworkDnsServersArgs, opts?: CustomResourceOptions);
    @overload
    def VirtualNetworkDnsServers(resource_name: str,
                                 args: VirtualNetworkDnsServersArgs,
                                 opts: Optional[ResourceOptions] = None)
    
    @overload
    def VirtualNetworkDnsServers(resource_name: str,
                                 opts: Optional[ResourceOptions] = None,
                                 virtual_network_id: Optional[str] = None,
                                 dns_servers: Optional[Sequence[str]] = None)
    func NewVirtualNetworkDnsServers(ctx *Context, name string, args VirtualNetworkDnsServersArgs, opts ...ResourceOption) (*VirtualNetworkDnsServers, error)
    public VirtualNetworkDnsServers(string name, VirtualNetworkDnsServersArgs args, CustomResourceOptions? opts = null)
    public VirtualNetworkDnsServers(String name, VirtualNetworkDnsServersArgs args)
    public VirtualNetworkDnsServers(String name, VirtualNetworkDnsServersArgs args, CustomResourceOptions options)
    
    type: azure:network:VirtualNetworkDnsServers
    properties: # The arguments to resource properties.
    options: # Bag of options to control resource's behavior.
    
    

    Parameters

    name string
    The unique name of the resource.
    args VirtualNetworkDnsServersArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    resource_name str
    The unique name of the resource.
    args VirtualNetworkDnsServersArgs
    The arguments to resource properties.
    opts ResourceOptions
    Bag of options to control resource's behavior.
    ctx Context
    Context object for the current deployment.
    name string
    The unique name of the resource.
    args VirtualNetworkDnsServersArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args VirtualNetworkDnsServersArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args VirtualNetworkDnsServersArgs
    The arguments to resource properties.
    options CustomResourceOptions
    Bag of options to control resource's behavior.

    Example

    The following reference example uses placeholder values for all input properties.

    var virtualNetworkDnsServersResource = new Azure.Network.VirtualNetworkDnsServers("virtualNetworkDnsServersResource", new()
    {
        VirtualNetworkId = "string",
        DnsServers = new[]
        {
            "string",
        },
    });
    
    example, err := network.NewVirtualNetworkDnsServers(ctx, "virtualNetworkDnsServersResource", &network.VirtualNetworkDnsServersArgs{
    	VirtualNetworkId: pulumi.String("string"),
    	DnsServers: pulumi.StringArray{
    		pulumi.String("string"),
    	},
    })
    
    var virtualNetworkDnsServersResource = new VirtualNetworkDnsServers("virtualNetworkDnsServersResource", VirtualNetworkDnsServersArgs.builder()
        .virtualNetworkId("string")
        .dnsServers("string")
        .build());
    
    virtual_network_dns_servers_resource = azure.network.VirtualNetworkDnsServers("virtualNetworkDnsServersResource",
        virtual_network_id="string",
        dns_servers=["string"])
    
    const virtualNetworkDnsServersResource = new azure.network.VirtualNetworkDnsServers("virtualNetworkDnsServersResource", {
        virtualNetworkId: "string",
        dnsServers: ["string"],
    });
    
    type: azure:network:VirtualNetworkDnsServers
    properties:
        dnsServers:
            - string
        virtualNetworkId: string
    

    VirtualNetworkDnsServers Resource Properties

    To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.

    Inputs

    The VirtualNetworkDnsServers resource accepts the following input properties:

    VirtualNetworkId string
    The ID of the Virtual Network that should be linked to the DNS Zone. Changing this forces a new resource to be created.
    DnsServers List<string>
    List of IP addresses of DNS servers
    VirtualNetworkId string
    The ID of the Virtual Network that should be linked to the DNS Zone. Changing this forces a new resource to be created.
    DnsServers []string
    List of IP addresses of DNS servers
    virtualNetworkId String
    The ID of the Virtual Network that should be linked to the DNS Zone. Changing this forces a new resource to be created.
    dnsServers List<String>
    List of IP addresses of DNS servers
    virtualNetworkId string
    The ID of the Virtual Network that should be linked to the DNS Zone. Changing this forces a new resource to be created.
    dnsServers string[]
    List of IP addresses of DNS servers
    virtual_network_id str
    The ID of the Virtual Network that should be linked to the DNS Zone. Changing this forces a new resource to be created.
    dns_servers Sequence[str]
    List of IP addresses of DNS servers
    virtualNetworkId String
    The ID of the Virtual Network that should be linked to the DNS Zone. Changing this forces a new resource to be created.
    dnsServers List<String>
    List of IP addresses of DNS servers

    Outputs

    All input properties are implicitly available as output properties. Additionally, the VirtualNetworkDnsServers resource produces the following output properties:

    Id string
    The provider-assigned unique ID for this managed resource.
    Id string
    The provider-assigned unique ID for this managed resource.
    id String
    The provider-assigned unique ID for this managed resource.
    id string
    The provider-assigned unique ID for this managed resource.
    id str
    The provider-assigned unique ID for this managed resource.
    id String
    The provider-assigned unique ID for this managed resource.

    Look up Existing VirtualNetworkDnsServers Resource

    Get an existing VirtualNetworkDnsServers resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.

    public static get(name: string, id: Input<ID>, state?: VirtualNetworkDnsServersState, opts?: CustomResourceOptions): VirtualNetworkDnsServers
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            dns_servers: Optional[Sequence[str]] = None,
            virtual_network_id: Optional[str] = None) -> VirtualNetworkDnsServers
    func GetVirtualNetworkDnsServers(ctx *Context, name string, id IDInput, state *VirtualNetworkDnsServersState, opts ...ResourceOption) (*VirtualNetworkDnsServers, error)
    public static VirtualNetworkDnsServers Get(string name, Input<string> id, VirtualNetworkDnsServersState? state, CustomResourceOptions? opts = null)
    public static VirtualNetworkDnsServers get(String name, Output<String> id, VirtualNetworkDnsServersState state, CustomResourceOptions options)
    Resource lookup is not supported in YAML
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    resource_name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    The following state arguments are supported:
    DnsServers List<string>
    List of IP addresses of DNS servers
    VirtualNetworkId string
    The ID of the Virtual Network that should be linked to the DNS Zone. Changing this forces a new resource to be created.
    DnsServers []string
    List of IP addresses of DNS servers
    VirtualNetworkId string
    The ID of the Virtual Network that should be linked to the DNS Zone. Changing this forces a new resource to be created.
    dnsServers List<String>
    List of IP addresses of DNS servers
    virtualNetworkId String
    The ID of the Virtual Network that should be linked to the DNS Zone. Changing this forces a new resource to be created.
    dnsServers string[]
    List of IP addresses of DNS servers
    virtualNetworkId string
    The ID of the Virtual Network that should be linked to the DNS Zone. Changing this forces a new resource to be created.
    dns_servers Sequence[str]
    List of IP addresses of DNS servers
    virtual_network_id str
    The ID of the Virtual Network that should be linked to the DNS Zone. Changing this forces a new resource to be created.
    dnsServers List<String>
    List of IP addresses of DNS servers
    virtualNetworkId String
    The ID of the Virtual Network that should be linked to the DNS Zone. Changing this forces a new resource to be created.

    Import

    Virtual Network DNS Servers can be imported using the resource id, e.g.

    $ pulumi import azure:network/virtualNetworkDnsServers:VirtualNetworkDnsServers exampleNetwork /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/mygroup1/providers/Microsoft.Network/virtualNetworks/myvnet1/dnsServers/default
    

    To learn more about importing existing cloud resources, see Importing resources.

    Package Details

    Repository
    Azure Classic pulumi/pulumi-azure
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the azurerm Terraform Provider.
    azure logo

    We recommend using Azure Native.

    Azure Classic v5.80.0 published on Monday, Jun 10, 2024 by Pulumi