import * as pulumi from "@pulumi/pulumi"; import * as inputs from "../types/input"; import * as outputs from "../types/output"; /** * Configures Network Packet Capturing against a Virtual Machine using a Network Watcher. * * ## Example Usage * * ```typescript * 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 exampleNetworkWatcher = new azure.network.NetworkWatcher("example", { * name: "example-nw", * location: example.location, * resourceGroupName: example.name, * }); * 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.2.0/24"], * }); * 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 exampleVirtualMachine = new azure.compute.VirtualMachine("example", { * name: "example-vm", * location: example.location, * resourceGroupName: example.name, * networkInterfaceIds: [exampleNetworkInterface.id], * vmSize: "Standard_F2", * storageImageReference: { * publisher: "Canonical", * offer: "0001-com-ubuntu-server-jammy", * sku: "22_04-lts", * version: "latest", * }, * storageOsDisk: { * name: "osdisk", * caching: "ReadWrite", * createOption: "FromImage", * managedDiskType: "Standard_LRS", * }, * osProfile: { * computerName: "pctest-vm", * adminUsername: "testadmin", * adminPassword: "Password1234!", * }, * osProfileLinuxConfig: { * disablePasswordAuthentication: false, * }, * }); * const exampleExtension = new azure.compute.Extension("example", { * name: "network-watcher", * virtualMachineId: exampleVirtualMachine.id, * publisher: "Microsoft.Azure.NetworkWatcher", * type: "NetworkWatcherAgentLinux", * typeHandlerVersion: "1.4", * autoUpgradeMinorVersion: true, * }); * const exampleAccount = new azure.storage.Account("example", { * name: "examplesa", * resourceGroupName: example.name, * location: example.location, * accountTier: "Standard", * accountReplicationType: "LRS", * }); * const examplePacketCapture = new azure.compute.PacketCapture("example", { * name: "example-pc", * networkWatcherId: exampleNetworkWatcher.id, * virtualMachineId: exampleVirtualMachine.id, * storageLocation: { * storageAccountId: exampleAccount.id, * }, * }, { * dependsOn: [exampleExtension], * }); * ``` * * > **Note:** This Resource requires that [the Network Watcher Virtual Machine Extension](https://docs.microsoft.com/azure/network-watcher/network-watcher-packet-capture-manage-portal#before-you-begin) is installed on the Virtual Machine before capturing can be enabled which can be installed via the `azure.compute.Extension` resource. * * ## API Providers * * * This resource uses the following Azure API Providers: * * * `Microsoft.Network` - 2025-01-01 * * ## Import * * Virtual Machine Packet Captures can be imported using the `resource id`, e.g. * * ```sh * $ pulumi import azure:compute/packetCapture:PacketCapture capture1 /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/mygroup1/providers/Microsoft.Network/networkWatchers/watcher1/packetCaptures/capture1 * ``` */ export declare class PacketCapture extends pulumi.CustomResource { /** * Get an existing PacketCapture resource's state with the given name, ID, and optional extra * properties used to qualify the lookup. * * @param name The _unique_ name of the resulting resource. * @param id The _unique_ provider ID of the resource to lookup. * @param state Any extra arguments used during the lookup. * @param opts Optional settings to control the behavior of the CustomResource. */ static get(name: string, id: pulumi.Input, state?: PacketCaptureState, opts?: pulumi.CustomResourceOptions): PacketCapture; /** * Returns true if the given object is an instance of PacketCapture. This is designed to work even * when multiple copies of the Pulumi SDK have been loaded into the same process. */ static isInstance(obj: any): obj is PacketCapture; /** * One or more `filter` blocks as defined below. Changing this forces a new resource to be created. */ readonly filters: pulumi.Output; /** * The number of bytes captured per packet. The remaining bytes are truncated. Defaults to `0` (Entire Packet Captured). Changing this forces a new resource to be created. */ readonly maximumBytesPerPacket: pulumi.Output; /** * Maximum size of the capture in Bytes. Defaults to `1073741824` (1GB). Changing this forces a new resource to be created. */ readonly maximumBytesPerSession: pulumi.Output; /** * The maximum duration of the capture session in seconds. Defaults to `18000` (5 hours). Changing this forces a new resource to be created. */ readonly maximumCaptureDurationInSeconds: pulumi.Output; /** * The name to use for this Network Packet Capture. Changing this forces a new resource to be created. */ readonly name: pulumi.Output; /** * The resource ID of the Network Watcher. Changing this forces a new resource to be created. */ readonly networkWatcherId: pulumi.Output; /** * A `storageLocation` block as defined below. Changing this forces a new resource to be created. */ readonly storageLocation: pulumi.Output; /** * The resource ID of the target Virtual Machine to capture packets from. Changing this forces a new resource to be created. */ readonly virtualMachineId: pulumi.Output; /** * Create a PacketCapture resource with the given unique name, arguments, and options. * * @param name The _unique_ name of the resource. * @param args The arguments to use to populate this resource's properties. * @param opts A bag of options that control this resource's behavior. */ constructor(name: string, args: PacketCaptureArgs, opts?: pulumi.CustomResourceOptions); } /** * Input properties used for looking up and filtering PacketCapture resources. */ export interface PacketCaptureState { /** * One or more `filter` blocks as defined below. Changing this forces a new resource to be created. */ filters?: pulumi.Input[]>; /** * The number of bytes captured per packet. The remaining bytes are truncated. Defaults to `0` (Entire Packet Captured). Changing this forces a new resource to be created. */ maximumBytesPerPacket?: pulumi.Input; /** * Maximum size of the capture in Bytes. Defaults to `1073741824` (1GB). Changing this forces a new resource to be created. */ maximumBytesPerSession?: pulumi.Input; /** * The maximum duration of the capture session in seconds. Defaults to `18000` (5 hours). Changing this forces a new resource to be created. */ maximumCaptureDurationInSeconds?: pulumi.Input; /** * The name to use for this Network Packet Capture. Changing this forces a new resource to be created. */ name?: pulumi.Input; /** * The resource ID of the Network Watcher. Changing this forces a new resource to be created. */ networkWatcherId?: pulumi.Input; /** * A `storageLocation` block as defined below. Changing this forces a new resource to be created. */ storageLocation?: pulumi.Input; /** * The resource ID of the target Virtual Machine to capture packets from. Changing this forces a new resource to be created. */ virtualMachineId?: pulumi.Input; } /** * The set of arguments for constructing a PacketCapture resource. */ export interface PacketCaptureArgs { /** * One or more `filter` blocks as defined below. Changing this forces a new resource to be created. */ filters?: pulumi.Input[]>; /** * The number of bytes captured per packet. The remaining bytes are truncated. Defaults to `0` (Entire Packet Captured). Changing this forces a new resource to be created. */ maximumBytesPerPacket?: pulumi.Input; /** * Maximum size of the capture in Bytes. Defaults to `1073741824` (1GB). Changing this forces a new resource to be created. */ maximumBytesPerSession?: pulumi.Input; /** * The maximum duration of the capture session in seconds. Defaults to `18000` (5 hours). Changing this forces a new resource to be created. */ maximumCaptureDurationInSeconds?: pulumi.Input; /** * The name to use for this Network Packet Capture. Changing this forces a new resource to be created. */ name?: pulumi.Input; /** * The resource ID of the Network Watcher. Changing this forces a new resource to be created. */ networkWatcherId: pulumi.Input; /** * A `storageLocation` block as defined below. Changing this forces a new resource to be created. */ storageLocation: pulumi.Input; /** * The resource ID of the target Virtual Machine to capture packets from. Changing this forces a new resource to be created. */ virtualMachineId: pulumi.Input; }