Expand description
Configures Network Packet Capturing against a Virtual Machine Scale Set using a Network Watcher.
§Example Usage
ⓘ
use pulumi_wasm_rust::Output;
use pulumi_wasm_rust::{add_export, pulumi_main};
#[pulumi_main]
fn test_main() -> Result<(), Error> {
let example = resource_group::create(
"example",
ResourceGroupArgs::builder()
.location("West Europe")
.name("example-resources")
.build_struct(),
);
let exampleLinuxVirtualMachineScaleSet = linux_virtual_machine_scale_set::create(
"exampleLinuxVirtualMachineScaleSet",
LinuxVirtualMachineScaleSetArgs::builder()
.admin_password("P@ssword1234!")
.admin_username("adminuser")
.computer_name_prefix("my-linux-computer-name-prefix")
.disable_password_authentication(false)
.instances(4)
.location("${example.location}")
.name("example-vmss")
.network_interfaces(
vec![
LinuxVirtualMachineScaleSetNetworkInterface::builder()
.ipConfigurations(vec![LinuxVirtualMachineScaleSetNetworkInterfaceIpConfiguration::builder()
.name("internal").primary(true).subnetId("${exampleSubnet.id}")
.build_struct(),]).name("example").primary(true).build_struct(),
],
)
.os_disk(
LinuxVirtualMachineScaleSetOsDisk::builder()
.caching("ReadWrite")
.storageAccountType("Standard_LRS")
.build_struct(),
)
.resource_group_name("${example.name}")
.sku("Standard_F2")
.source_image_reference(
LinuxVirtualMachineScaleSetSourceImageReference::builder()
.offer("0001-com-ubuntu-server-jammy")
.publisher("Canonical")
.sku("22_04-lts")
.version("latest")
.build_struct(),
)
.upgrade_mode("Automatic")
.build_struct(),
);
let exampleNetworkWatcher = network_watcher::create(
"exampleNetworkWatcher",
NetworkWatcherArgs::builder()
.location("${example.location}")
.name("example-nw")
.resource_group_name("${example.name}")
.build_struct(),
);
let exampleScaleSetPacketCapture = scale_set_packet_capture::create(
"exampleScaleSetPacketCapture",
ScaleSetPacketCaptureArgs::builder()
.machine_scope(
ScaleSetPacketCaptureMachineScope::builder()
.excludeInstanceIds(vec!["1",])
.includeInstanceIds(vec!["0",])
.build_struct(),
)
.name("example-pc")
.network_watcher_id("${exampleNetworkWatcher.id}")
.storage_location(
ScaleSetPacketCaptureStorageLocation::builder()
.filePath("/var/captures/packet.cap")
.build_struct(),
)
.virtual_machine_scale_set_id("${exampleLinuxVirtualMachineScaleSet.id}")
.build_struct(),
);
let exampleSubnet = subnet::create(
"exampleSubnet",
SubnetArgs::builder()
.address_prefixes(vec!["10.0.2.0/24",])
.name("internal")
.resource_group_name("${example.name}")
.virtual_network_name("${exampleVirtualNetwork.name}")
.build_struct(),
);
let exampleVirtualMachineScaleSetExtension = virtual_machine_scale_set_extension::create(
"exampleVirtualMachineScaleSetExtension",
VirtualMachineScaleSetExtensionArgs::builder()
.auto_upgrade_minor_version(true)
.automatic_upgrade_enabled(true)
.name("network-watcher")
.publisher("Microsoft.Azure.NetworkWatcher")
.type_("NetworkWatcherAgentLinux")
.type_handler_version("1.4")
.virtual_machine_scale_set_id("${exampleLinuxVirtualMachineScaleSet.id}")
.build_struct(),
);
let exampleVirtualNetwork = virtual_network::create(
"exampleVirtualNetwork",
VirtualNetworkArgs::builder()
.address_spaces(vec!["10.0.0.0/16",])
.location("${example.location}")
.name("example-vn")
.resource_group_name("${example.name}")
.build_struct(),
);
}
NOTE: This Resource requires that the Network Watcher Extension is installed on the Virtual Machine Scale Set before capturing can be enabled which can be installed via the
azure.compute.VirtualMachineScaleSetExtension
resource.
§Import
Virtual Machine Scale Set Packet Captures can be imported using the resource id
, e.g.
$ pulumi import azure:compute/scaleSetPacketCapture:ScaleSetPacketCapture capture1 /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/mygroup1/providers/Microsoft.Network/networkWatchers/watcher1/packetCaptures/capture1
Structs§
- Use builder syntax to set the inputs and finish with
build_struct()
.
Functions§
- Registers a new resource with the given unique name and arguments