About This Page
This page is part of the Azure documentation. It contains code examples and configuration instructions for working with Azure services.
Bias Analysis
Bias Types:
⚠️
powershell_heavy
⚠️
windows_tools
⚠️
missing_linux_example
⚠️
windows_first
Summary:
The documentation provides detailed instructions for performing the NSG relocation using the Azure Portal and PowerShell, with all CLI-based automation examples using PowerShell cmdlets. There are no examples or guidance for performing these tasks using Azure CLI (az), Bash, or other cross-platform tools, which are commonly used on Linux and macOS. The PowerShell approach is presented as the only scripting/automation method, and even text editor examples reference Notepad, a Windows tool.
Recommendations:
- Add equivalent step-by-step instructions using Azure CLI (az) commands for all automation tasks, including exporting, editing, and deploying ARM templates.
- Provide Bash shell examples for editing JSON files, such as using vim, nano, or other cross-platform editors, instead of only referencing Notepad.
- Ensure that all PowerShell examples are accompanied by Azure CLI equivalents, and present both options in parallel tabs or sections.
- Avoid referencing Windows-only tools or patterns (like Notepad) without mentioning cross-platform alternatives.
- Consider including a note at the top clarifying that the instructions apply equally to Windows, Linux, and macOS, and link to Azure CLI documentation for users on non-Windows platforms.
Create pull request
Flagged Code Snippets
1. Obtain the resource ID of the NSG you want to move to the target region and place it in a variable using [Get-AzNetworkSecurityGroup](/powershell/module/az.network/get-aznetworksecuritygroup):
1. Save the **\<resource-group-name>.json** file.
---
## Redeploy
### [Portal](#tab/azure-portal)
1. Select **BASICS** > **Subscription** to choose the subscription where the target NSG will be deployed.
1. Select **BASICS** > **Resource group** to choose the resource group where the target NSG will be deployed. You can click **Create new** to create a new resource group for the target NSG. Ensure the name isn't the same as the source resource group of the existing NSG.
1. Select **BASICS** > **Location** is set to the target location where you wish for the NSG to be deployed.
1. Verify under **SETTINGS** that the name matches the name that you entered in the parameters editor above.
1. Check the box under **TERMS AND CONDITIONS**.
1. Select the **Purchase** button to deploy the target network security group.
### [PowerShell](#tab/azure-powershell)
1. Create a resource group in the target region for the target NSG to be deployed using [New-AzResourceGroup](/powershell/module/az.resources/new-azresourcegroup):
---
## Clean up
### [Portal](#tab/azure-portal)
To commit the changes and complete the move of the NSG, delete the source NSG or resource group. To do so, select the network security group or resource group from your dashboard in the portal and select **Delete** at the top of each page.
### [PowerShell](#tab/azure-powershell)
To commit the changes and complete the move of the NSG, delete the source NSG or resource group, use [Remove-AzResourceGroup](/powershell/module/az.resources/remove-azresourcegroup) or [Remove-AzNetworkSecurityGroup](/powershell/module/az.network/remove-aznetworksecuritygroup):