I need to send log messages out of a VM so last week I created a Network Security Group via PowerShell and traffic started flowing out. On Friday we stopped receiving traffic unexpectedly. I can still connect to our remote IP/Port from other locations but not from our Azure VM. I deleted/re-created the rule on Network Security Group and updated the VM several times but so far nothing has worked. When I try to remove the Network Security Group from the VM I get the below error message. I'm not sure where to go from here. Azure has been nothing but frustrating.
C:\> Get-AzureVM -ServiceName "testtsservice" -Name "testtsservice" | Remove-AzureNetworkSecurityGroupConfig -NetworkSecurityGroupName "AzureSNG1"BOSE: 10:41:22 AM - Completed Operation: Get Deployment
ove-AzureNetworkSecurityGroupConfig : 10:41:22 AM - Cannot remove Network Security Group "AzureSNG1" from Virtual Machine "tstesttsservice" because it is not directly.
line:1 char:70
et-AzureVM -ServiceName "tstesttsservice" -Name "tstesttsservice" | Remove-Azur ...
~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Remove-AzureNetworkSecurityGroupConfig], Exception
+ FullyQualifiedErrorId : Microsoft.WindowsAzure.Commands.ServiceManagement.IaaS.RemoveAzureNetworkSecurityGroupConfigCommand
The NSG was created using the following commands.
New-AzureNetworkSecurityGroup -Name "AzureSNG1" -location "West US"
Get-AzureNetworkSecurityGroup -Name "AzureSNG1" | Set-AzureNetworkSecurityRule -Name "AzureLogOut" -Type Outbound -Priority 100 -Action Allow -SourceAddressPrefix 'VIRTUAL_NETWORK' -SourcePortRange '*' -DestinationAddressPrefix 'our_remote_ip.0/24' -DestinationPortRange "3515" -protocol '*'
I assign the NSG to the VM with this command.
Get-AzureVM -ServiceName "tstesttsservice" -Name "tstesttsservice" | Set-AzureNetworkSecurityGroupConfig -NetworkSecurityGroupName "AzureSNG1"
And then update the VM.
$VM = Get-AzureVM -ServiceName "tstesttsservice" -Name "tstesttsservice"
Update-AzureVM -VM $VM.VM -Name $VM.Name -ServiceName $VM.ServiceName