Sad Tux - Windows bias detected
This page contains Windows bias

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

Detected Bias Types
powershell_heavy
missing_linux_example
windows_tools
windows_first
Summary
The documentation provides detailed instructions for relocating an Azure NSG using the Azure Portal and PowerShell, with all CLI examples and automation steps relying exclusively on PowerShell cmdlets. There are no examples or guidance for Linux users, such as using Azure CLI (az), Bash, or cross-platform editors. Windows tools like Notepad are referenced, and the PowerShell approach is presented as the sole scripting method, which may disadvantage users on Linux or macOS.
Recommendations
  • Add equivalent Azure CLI (az) examples for all PowerShell steps, including authentication, resource export, template editing, deployment, and cleanup.
  • Reference cross-platform text editors (e.g., VS Code, nano, vim) instead of or alongside Notepad.
  • Explicitly mention that both PowerShell and Azure CLI are supported, and provide tabs for each where applicable.
  • Ensure that instructions for obtaining region codes and other metadata include Azure CLI commands.
  • Review and update prerequisites and process steps to avoid assuming a Windows environment or toolset.
GitHub Create Pull Request

Scan History

Date Scan Status Result
2026-01-12 00:00 #99 completed Biased Biased
2026-01-11 06:20 #98 completed Biased Biased
2026-01-10 00:00 #92 completed Clean Clean
2026-01-09 00:00 #87 cancelled Clean Clean
2026-01-06 22:28 #78 completed Clean Clean
2025-12-29 18:00 #48 cancelled Biased Biased
2025-12-15 00:00 #7 completed Clean Clean
2025-12-14 05:05 #6 completed Clean Clean

Flagged Code Snippets

1. Export the source NSG to a .json file into the directory where you execute the command [Export-AzResourceGroup](/powershell/module/az.resources/export-azresourcegroup):

   
1. Deploy the edited **\<resource-group-name>.json** file to the resource group created in the previous step using [New-AzResourceGroupDeployment](/powershell/module/az.resources/new-azresourcegroupdeployment):

    
        "resources": [
        {
          "type": "Microsoft.Network/networkSecurityGroups",
          "apiVersion": "2019-06-01",
          "name": "[parameters('networkSecurityGroups_myVM1_nsg_name')]",
          "location": "<target-region>",
          "properties": {
            "provisioningState": "Succeeded",
            "resourceGuid": "2c846acf-58c8-416d-be97-ccd00a4ccd78",
            "securityRules": [
              {
                "name": "RDP",
                "etag": "W/\"c630c458-6b52-4202-8fd7-172b7ab49cf5\"",
                "properties": {
                  "provisioningState": "Succeeded",
                  "protocol": "TCP",
                  "sourcePortRange": "*",
                  "destinationPortRange": "3389",
                  "sourceAddressPrefix": "*",
                  "destinationAddressPrefix": "*",
                  "access": "Allow",
                  "priority": 300,
                  "direction": "Inbound",
                  "sourcePortRanges": [],
                  "destinationPortRanges": [],
                  "sourceAddressPrefixes": [],
                  "destinationAddressPrefixes": []
                }
              }
            ]
          }
        }
        
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. To obtain region location codes, you can use the Azure PowerShell cmdlet [Get-AzLocation](/powershell/module/az.resources/get-azlocation) by running the following command:

    
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):

    
1. To verify the resources were created in the target region, use [Get-AzResourceGroup](/powershell/module/az.resources/get-azresourcegroup) and [Get-AzNetworkSecurityGroup](/powershell/module/az.network/get-aznetworksecuritygroup):

    
---

## Discard

### [Portal](#tab/azure-portal)

If you wish to discard the target NSG, delete the resource group that contains the target NSG.  To do so, select the resource group from your dashboard in the portal and select **Delete** at the top of the overview page.

### [PowerShell](#tab/azure-powershell)

After the deployment, if you wish to start over or discard the NSG in the target, delete the resource group that was created in the target and the moved NSG will be deleted.  To remove the resource group, use [Remove-AzResourceGroup](/powershell/module/az.resources/remove-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):