We recommend using Azure Native.
azure.network.NetworkInterfaceApplicationSecurityGroupAssociation
Explore with Pulumi AI
Manages the association between a Network Interface and a Application Security Group.
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-network",
    addressSpaces: ["10.0.0.0/16"],
    location: example.location,
    resourceGroupName: example.name,
});
const exampleSubnet = new azure.network.Subnet("example", {
    name: "internal",
    resourceGroupName: example.name,
    virtualNetworkName: exampleVirtualNetwork.name,
    addressPrefixes: ["10.0.1.0/24"],
});
const exampleApplicationSecurityGroup = new azure.network.ApplicationSecurityGroup("example", {
    name: "example-asg",
    location: example.location,
    resourceGroupName: example.name,
});
const exampleNetworkInterface = new azure.network.NetworkInterface("example", {
    name: "example-nic",
    location: example.location,
    resourceGroupName: example.name,
    ipConfigurations: [{
        name: "testconfiguration1",
        subnetId: exampleSubnet.id,
        privateIpAddressAllocation: "Dynamic",
    }],
});
const exampleNetworkInterfaceApplicationSecurityGroupAssociation = new azure.network.NetworkInterfaceApplicationSecurityGroupAssociation("example", {
    networkInterfaceId: exampleNetworkInterface.id,
    applicationSecurityGroupId: exampleApplicationSecurityGroup.id,
});
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-network",
    address_spaces=["10.0.0.0/16"],
    location=example.location,
    resource_group_name=example.name)
example_subnet = azure.network.Subnet("example",
    name="internal",
    resource_group_name=example.name,
    virtual_network_name=example_virtual_network.name,
    address_prefixes=["10.0.1.0/24"])
example_application_security_group = azure.network.ApplicationSecurityGroup("example",
    name="example-asg",
    location=example.location,
    resource_group_name=example.name)
example_network_interface = azure.network.NetworkInterface("example",
    name="example-nic",
    location=example.location,
    resource_group_name=example.name,
    ip_configurations=[azure.network.NetworkInterfaceIpConfigurationArgs(
        name="testconfiguration1",
        subnet_id=example_subnet.id,
        private_ip_address_allocation="Dynamic",
    )])
example_network_interface_application_security_group_association = azure.network.NetworkInterfaceApplicationSecurityGroupAssociation("example",
    network_interface_id=example_network_interface.id,
    application_security_group_id=example_application_security_group.id)
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-network"),
			AddressSpaces: pulumi.StringArray{
				pulumi.String("10.0.0.0/16"),
			},
			Location:          example.Location,
			ResourceGroupName: example.Name,
		})
		if err != nil {
			return err
		}
		exampleSubnet, err := network.NewSubnet(ctx, "example", &network.SubnetArgs{
			Name:               pulumi.String("internal"),
			ResourceGroupName:  example.Name,
			VirtualNetworkName: exampleVirtualNetwork.Name,
			AddressPrefixes: pulumi.StringArray{
				pulumi.String("10.0.1.0/24"),
			},
		})
		if err != nil {
			return err
		}
		exampleApplicationSecurityGroup, err := network.NewApplicationSecurityGroup(ctx, "example", &network.ApplicationSecurityGroupArgs{
			Name:              pulumi.String("example-asg"),
			Location:          example.Location,
			ResourceGroupName: example.Name,
		})
		if err != nil {
			return err
		}
		exampleNetworkInterface, err := network.NewNetworkInterface(ctx, "example", &network.NetworkInterfaceArgs{
			Name:              pulumi.String("example-nic"),
			Location:          example.Location,
			ResourceGroupName: example.Name,
			IpConfigurations: network.NetworkInterfaceIpConfigurationArray{
				&network.NetworkInterfaceIpConfigurationArgs{
					Name:                       pulumi.String("testconfiguration1"),
					SubnetId:                   exampleSubnet.ID(),
					PrivateIpAddressAllocation: pulumi.String("Dynamic"),
				},
			},
		})
		if err != nil {
			return err
		}
		_, err = network.NewNetworkInterfaceApplicationSecurityGroupAssociation(ctx, "example", &network.NetworkInterfaceApplicationSecurityGroupAssociationArgs{
			NetworkInterfaceId:         exampleNetworkInterface.ID(),
			ApplicationSecurityGroupId: exampleApplicationSecurityGroup.ID(),
		})
		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-network",
        AddressSpaces = new[]
        {
            "10.0.0.0/16",
        },
        Location = example.Location,
        ResourceGroupName = example.Name,
    });
    var exampleSubnet = new Azure.Network.Subnet("example", new()
    {
        Name = "internal",
        ResourceGroupName = example.Name,
        VirtualNetworkName = exampleVirtualNetwork.Name,
        AddressPrefixes = new[]
        {
            "10.0.1.0/24",
        },
    });
    var exampleApplicationSecurityGroup = new Azure.Network.ApplicationSecurityGroup("example", new()
    {
        Name = "example-asg",
        Location = example.Location,
        ResourceGroupName = example.Name,
    });
    var exampleNetworkInterface = new Azure.Network.NetworkInterface("example", new()
    {
        Name = "example-nic",
        Location = example.Location,
        ResourceGroupName = example.Name,
        IpConfigurations = new[]
        {
            new Azure.Network.Inputs.NetworkInterfaceIpConfigurationArgs
            {
                Name = "testconfiguration1",
                SubnetId = exampleSubnet.Id,
                PrivateIpAddressAllocation = "Dynamic",
            },
        },
    });
    var exampleNetworkInterfaceApplicationSecurityGroupAssociation = new Azure.Network.NetworkInterfaceApplicationSecurityGroupAssociation("example", new()
    {
        NetworkInterfaceId = exampleNetworkInterface.Id,
        ApplicationSecurityGroupId = exampleApplicationSecurityGroup.Id,
    });
});
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.network.ApplicationSecurityGroup;
import com.pulumi.azure.network.ApplicationSecurityGroupArgs;
import com.pulumi.azure.network.NetworkInterface;
import com.pulumi.azure.network.NetworkInterfaceArgs;
import com.pulumi.azure.network.inputs.NetworkInterfaceIpConfigurationArgs;
import com.pulumi.azure.network.NetworkInterfaceApplicationSecurityGroupAssociation;
import com.pulumi.azure.network.NetworkInterfaceApplicationSecurityGroupAssociationArgs;
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-network")
            .addressSpaces("10.0.0.0/16")
            .location(example.location())
            .resourceGroupName(example.name())
            .build());
        var exampleSubnet = new Subnet("exampleSubnet", SubnetArgs.builder()
            .name("internal")
            .resourceGroupName(example.name())
            .virtualNetworkName(exampleVirtualNetwork.name())
            .addressPrefixes("10.0.1.0/24")
            .build());
        var exampleApplicationSecurityGroup = new ApplicationSecurityGroup("exampleApplicationSecurityGroup", ApplicationSecurityGroupArgs.builder()
            .name("example-asg")
            .location(example.location())
            .resourceGroupName(example.name())
            .build());
        var exampleNetworkInterface = new NetworkInterface("exampleNetworkInterface", NetworkInterfaceArgs.builder()
            .name("example-nic")
            .location(example.location())
            .resourceGroupName(example.name())
            .ipConfigurations(NetworkInterfaceIpConfigurationArgs.builder()
                .name("testconfiguration1")
                .subnetId(exampleSubnet.id())
                .privateIpAddressAllocation("Dynamic")
                .build())
            .build());
        var exampleNetworkInterfaceApplicationSecurityGroupAssociation = new NetworkInterfaceApplicationSecurityGroupAssociation("exampleNetworkInterfaceApplicationSecurityGroupAssociation", NetworkInterfaceApplicationSecurityGroupAssociationArgs.builder()
            .networkInterfaceId(exampleNetworkInterface.id())
            .applicationSecurityGroupId(exampleApplicationSecurityGroup.id())
            .build());
    }
}
resources:
  example:
    type: azure:core:ResourceGroup
    properties:
      name: example-resources
      location: West Europe
  exampleVirtualNetwork:
    type: azure:network:VirtualNetwork
    name: example
    properties:
      name: example-network
      addressSpaces:
        - 10.0.0.0/16
      location: ${example.location}
      resourceGroupName: ${example.name}
  exampleSubnet:
    type: azure:network:Subnet
    name: example
    properties:
      name: internal
      resourceGroupName: ${example.name}
      virtualNetworkName: ${exampleVirtualNetwork.name}
      addressPrefixes:
        - 10.0.1.0/24
  exampleApplicationSecurityGroup:
    type: azure:network:ApplicationSecurityGroup
    name: example
    properties:
      name: example-asg
      location: ${example.location}
      resourceGroupName: ${example.name}
  exampleNetworkInterface:
    type: azure:network:NetworkInterface
    name: example
    properties:
      name: example-nic
      location: ${example.location}
      resourceGroupName: ${example.name}
      ipConfigurations:
        - name: testconfiguration1
          subnetId: ${exampleSubnet.id}
          privateIpAddressAllocation: Dynamic
  exampleNetworkInterfaceApplicationSecurityGroupAssociation:
    type: azure:network:NetworkInterfaceApplicationSecurityGroupAssociation
    name: example
    properties:
      networkInterfaceId: ${exampleNetworkInterface.id}
      applicationSecurityGroupId: ${exampleApplicationSecurityGroup.id}
Create NetworkInterfaceApplicationSecurityGroupAssociation Resource
Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.
Constructor syntax
new NetworkInterfaceApplicationSecurityGroupAssociation(name: string, args: NetworkInterfaceApplicationSecurityGroupAssociationArgs, opts?: CustomResourceOptions);@overload
def NetworkInterfaceApplicationSecurityGroupAssociation(resource_name: str,
                                                        args: NetworkInterfaceApplicationSecurityGroupAssociationArgs,
                                                        opts: Optional[ResourceOptions] = None)
@overload
def NetworkInterfaceApplicationSecurityGroupAssociation(resource_name: str,
                                                        opts: Optional[ResourceOptions] = None,
                                                        application_security_group_id: Optional[str] = None,
                                                        network_interface_id: Optional[str] = None)func NewNetworkInterfaceApplicationSecurityGroupAssociation(ctx *Context, name string, args NetworkInterfaceApplicationSecurityGroupAssociationArgs, opts ...ResourceOption) (*NetworkInterfaceApplicationSecurityGroupAssociation, error)public NetworkInterfaceApplicationSecurityGroupAssociation(string name, NetworkInterfaceApplicationSecurityGroupAssociationArgs args, CustomResourceOptions? opts = null)
public NetworkInterfaceApplicationSecurityGroupAssociation(String name, NetworkInterfaceApplicationSecurityGroupAssociationArgs args)
public NetworkInterfaceApplicationSecurityGroupAssociation(String name, NetworkInterfaceApplicationSecurityGroupAssociationArgs args, CustomResourceOptions options)
type: azure:network:NetworkInterfaceApplicationSecurityGroupAssociation
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 NetworkInterfaceApplicationSecurityGroupAssociationArgs
 - 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 NetworkInterfaceApplicationSecurityGroupAssociationArgs
 - 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 NetworkInterfaceApplicationSecurityGroupAssociationArgs
 - The arguments to resource properties.
 - opts ResourceOption
 - Bag of options to control resource's behavior.
 
- name string
 - The unique name of the resource.
 - args NetworkInterfaceApplicationSecurityGroupAssociationArgs
 - The arguments to resource properties.
 - opts CustomResourceOptions
 - Bag of options to control resource's behavior.
 
- name String
 - The unique name of the resource.
 - args NetworkInterfaceApplicationSecurityGroupAssociationArgs
 - The arguments to resource properties.
 - options CustomResourceOptions
 - Bag of options to control resource's behavior.
 
Constructor example
The following reference example uses placeholder values for all input properties.
var networkInterfaceApplicationSecurityGroupAssociationResource = new Azure.Network.NetworkInterfaceApplicationSecurityGroupAssociation("networkInterfaceApplicationSecurityGroupAssociationResource", new()
{
    ApplicationSecurityGroupId = "string",
    NetworkInterfaceId = "string",
});
example, err := network.NewNetworkInterfaceApplicationSecurityGroupAssociation(ctx, "networkInterfaceApplicationSecurityGroupAssociationResource", &network.NetworkInterfaceApplicationSecurityGroupAssociationArgs{
	ApplicationSecurityGroupId: pulumi.String("string"),
	NetworkInterfaceId:         pulumi.String("string"),
})
var networkInterfaceApplicationSecurityGroupAssociationResource = new NetworkInterfaceApplicationSecurityGroupAssociation("networkInterfaceApplicationSecurityGroupAssociationResource", NetworkInterfaceApplicationSecurityGroupAssociationArgs.builder()
    .applicationSecurityGroupId("string")
    .networkInterfaceId("string")
    .build());
network_interface_application_security_group_association_resource = azure.network.NetworkInterfaceApplicationSecurityGroupAssociation("networkInterfaceApplicationSecurityGroupAssociationResource",
    application_security_group_id="string",
    network_interface_id="string")
const networkInterfaceApplicationSecurityGroupAssociationResource = new azure.network.NetworkInterfaceApplicationSecurityGroupAssociation("networkInterfaceApplicationSecurityGroupAssociationResource", {
    applicationSecurityGroupId: "string",
    networkInterfaceId: "string",
});
type: azure:network:NetworkInterfaceApplicationSecurityGroupAssociation
properties:
    applicationSecurityGroupId: string
    networkInterfaceId: string
NetworkInterfaceApplicationSecurityGroupAssociation 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 NetworkInterfaceApplicationSecurityGroupAssociation resource accepts the following input properties:
- Application
Security stringGroup Id  - The ID of the Application Security Group which this Network Interface which should be connected to. Changing this forces a new resource to be created.
 - Network
Interface stringId  - The ID of the Network Interface. Changing this forces a new resource to be created.
 
- Application
Security stringGroup Id  - The ID of the Application Security Group which this Network Interface which should be connected to. Changing this forces a new resource to be created.
 - Network
Interface stringId  - The ID of the Network Interface. Changing this forces a new resource to be created.
 
- application
Security StringGroup Id  - The ID of the Application Security Group which this Network Interface which should be connected to. Changing this forces a new resource to be created.
 - network
Interface StringId  - The ID of the Network Interface. Changing this forces a new resource to be created.
 
- application
Security stringGroup Id  - The ID of the Application Security Group which this Network Interface which should be connected to. Changing this forces a new resource to be created.
 - network
Interface stringId  - The ID of the Network Interface. Changing this forces a new resource to be created.
 
- application_
security_ strgroup_ id  - The ID of the Application Security Group which this Network Interface which should be connected to. Changing this forces a new resource to be created.
 - network_
interface_ strid  - The ID of the Network Interface. Changing this forces a new resource to be created.
 
- application
Security StringGroup Id  - The ID of the Application Security Group which this Network Interface which should be connected to. Changing this forces a new resource to be created.
 - network
Interface StringId  - The ID of the Network Interface. Changing this forces a new resource to be created.
 
Outputs
All input properties are implicitly available as output properties. Additionally, the NetworkInterfaceApplicationSecurityGroupAssociation 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 NetworkInterfaceApplicationSecurityGroupAssociation Resource
Get an existing NetworkInterfaceApplicationSecurityGroupAssociation 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?: NetworkInterfaceApplicationSecurityGroupAssociationState, opts?: CustomResourceOptions): NetworkInterfaceApplicationSecurityGroupAssociation@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        application_security_group_id: Optional[str] = None,
        network_interface_id: Optional[str] = None) -> NetworkInterfaceApplicationSecurityGroupAssociationfunc GetNetworkInterfaceApplicationSecurityGroupAssociation(ctx *Context, name string, id IDInput, state *NetworkInterfaceApplicationSecurityGroupAssociationState, opts ...ResourceOption) (*NetworkInterfaceApplicationSecurityGroupAssociation, error)public static NetworkInterfaceApplicationSecurityGroupAssociation Get(string name, Input<string> id, NetworkInterfaceApplicationSecurityGroupAssociationState? state, CustomResourceOptions? opts = null)public static NetworkInterfaceApplicationSecurityGroupAssociation get(String name, Output<String> id, NetworkInterfaceApplicationSecurityGroupAssociationState 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.
 
- Application
Security stringGroup Id  - The ID of the Application Security Group which this Network Interface which should be connected to. Changing this forces a new resource to be created.
 - Network
Interface stringId  - The ID of the Network Interface. Changing this forces a new resource to be created.
 
- Application
Security stringGroup Id  - The ID of the Application Security Group which this Network Interface which should be connected to. Changing this forces a new resource to be created.
 - Network
Interface stringId  - The ID of the Network Interface. Changing this forces a new resource to be created.
 
- application
Security StringGroup Id  - The ID of the Application Security Group which this Network Interface which should be connected to. Changing this forces a new resource to be created.
 - network
Interface StringId  - The ID of the Network Interface. Changing this forces a new resource to be created.
 
- application
Security stringGroup Id  - The ID of the Application Security Group which this Network Interface which should be connected to. Changing this forces a new resource to be created.
 - network
Interface stringId  - The ID of the Network Interface. Changing this forces a new resource to be created.
 
- application_
security_ strgroup_ id  - The ID of the Application Security Group which this Network Interface which should be connected to. Changing this forces a new resource to be created.
 - network_
interface_ strid  - The ID of the Network Interface. Changing this forces a new resource to be created.
 
- application
Security StringGroup Id  - The ID of the Application Security Group which this Network Interface which should be connected to. Changing this forces a new resource to be created.
 - network
Interface StringId  - The ID of the Network Interface. Changing this forces a new resource to be created.
 
Import
Associations between Network Interfaces and Application Security Groups can be imported using the resource id, e.g.
$ pulumi import azure:network/networkInterfaceApplicationSecurityGroupAssociation:NetworkInterfaceApplicationSecurityGroupAssociation association1 "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/mygroup1/providers/Microsoft.Network/networkInterfaces/nic1|/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.Network/applicationSecurityGroups/securityGroup1"
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 
azurermTerraform Provider.