title: Azure updating multiple NSG rules with powershell
body: <p>I'd like to update multiple NSG rules at once, based on a changing IP address list.
  For example, I'd like to update rules named ftp,ssh,https (and several others).
  Here is what I have so far:</p>
  <pre><code>$ips = @(&quot;10.1.1.2&quot;, &quot;10.1.1.3&quot;, &quot;192.168.0.0/16&quot;)
  $nsgName = &quot;Dev1-nsg&quot;
  $resourceGroupName = &quot;myResourceGrp1&quot;
  $nsg = Get-AzNetworkSecurityGroup -Name $nsgName -ResourceGroupName $resourceGroupName
  Set-AzNetworkSecurityRuleConfig -Name &quot;ftp&quot; -NetworkSecurityGroup $nsg -SourceAddressPrefix $ips
  Set-AzNetworkSecurityRuleConfig -Name &quot;ssh&quot; -NetworkSecurityGroup $nsg -SourceAddressPrefix $ips
  Set-AzNetworkSecurityRuleConfig -Name &quot;https&quot; -NetworkSecurityGroup $nsg -SourceAddressPrefix $ips
  Get-AzNetworkSecurityRuleConfig -Name &quot;ftp&quot; -NetworkSecurityGroup $nsg
  Get-AzNetworkSecurityRuleConfig -Name &quot;ssh&quot; -NetworkSecurityGroup $nsg
  Get-AzNetworkSecurityRuleConfig -Name &quot;https&quot; -NetworkSecurityGroup $nsg
  </code></pre>
  <p>My issues:</p>
  <ol>
  <li>When I run the above in Powershell, all seems fine, but when I go to the Azure nsg portal and refresh, the rules appear unchanged</li>
  <li>If I'm updating many rules (say 15), what's the best way to loop through a list of rule names to update each with the IP list?</li>
  </ol>