Moving an NSG to a Different Compartment

Move a network security group (NSG) in a Virtual Cloud Network (VCN) between compartments.

When you move an NSG to a new compartment, inherent policies apply immediately.

For more information about using compartments and policies to control access to resources in a cloud network, see Access Control. For general information about compartments, see Managing Compartments.

    1. On the Virtual Cloud Networks list page, select the VCN that contains the NSG you want to work with. If you need help finding the list page or the VCN, see Listing VCNs.
    2. On the details page, perform one of the following actions depending on the option that you see:
      • On the Security tab, go to the Network Security Groups section.
      • Under Resources, select Network Security Groups.
    3. From the Actions menu (three dots) for the NSG, select Move Resource.
    4. In the Move resource panel, select the destination compartment from the list.
    5. Select Move resource.
  • Use the network nsg change-compartment command and required parameters to move an NSG from one compartment to another:

    oci network nsg change-compartment --compartment-id destination-compartment-ocid --nsg-id nsg-ocid ... [OPTIONS]

    For a complete list of flags and variable options for CLI commands, see the CLI Command Reference.

  • Run the ChangeNetworkSecurityGroupCompartment operation to move an NSG from one compartment to another.