Changing a VM Network Security Group from Azure Portal - azure

I am trying to change the network security group in a VM, from azure portal.
From azure portal and going to Networking, I can see the actual network security group ("mygroup1"). I want to change it to "mygroup2".
If I press the Network security group name I can navigate to the azure portal but I cannot see the way to change the actual Network security group from my VM to a new existing one.
EDIT: The VM is connected. I suspect to do this I also have to shut it down I guess.
Can anyone help?

You cannot change the network security group in a VM, instead:
You can associate a network security group to, or dissociate a network security group from a network interface.
https://learn.microsoft.com/en-us/azure/virtual-network/virtual-network-network-interface#associate-or-dissociate-a-network-security-group
In the search box at the top of the portal, enter network interfaces in the search box. When network interfaces appear in the search results, select it.
Select the network interface in the list that you want to associate a network security group to, or dissociate a network security group from.
Select Network security group under SETTINGS.
Select Edit.
Select Network security group and then select the network security group you want to associate to the network interface, or select None, to dissociate a network security group. Save
You can Associate a network security group to, or dissociate a network security group from a subnet. https://learn.microsoft.com/en-us/azure/virtual-network/virtual-network-manage-subnet#change-subnet-settings
Go to the Azure portal to view your virtual networks. Search for and select Virtual networks.
Select the name of the virtual network containing the subnet you want to change.
From Settings, select Subnets.
In the list of subnets, select the subnet you want to change settings for.
In the subnet page, change any of the following settings: Network security group
Click Save

Related

Disconnect an Azure VM from Internet

I have to test the behavior of a SharePoint migration tool installed on my Azure VM when Internet connection is lost.
I access to this VM by RDP.
How can I cut off Internet connection of my VM and restore it later ?
Thanks in advance.
I second the suggestions posted by 4c74356b41, you could also disable the Network Adapter and then reset the Network adapter to restore the connection. If you wish to take this approach checkout these steps:
For VMs deployed in Resource group model
Go to the Azure portal.
Select the affected Virtual Machine.
Select Network Interfaces.
Select the Network Interface associated with your machine
Select IP configurations.
Select the IP.
If the Private IP assignment is not Static, change it to Static.
Change the IP address to another IP address that is available in the Subnet.
The virtual machine will restart to initialize the new NIC to the system.
Try to RDP to your machine. If successful, you can change the Private IP address back to the original if you would like. Otherwise, you can keep it.
Delete the unavailable NICs
After you can remote desktop to the machine, you must delete the old NICs to avoid the potential problem:
Open Device Manager.
Select View > Show hidden devices.
Select Network Adapters.
Check for the adapters named as "Microsoft Hyper-V Network Adapter".
You might see an unavailable adapter that is grayed out. Right-click the adapter and then select Uninstall.
Ref: https://learn.microsoft.com/en-us/azure/virtual-machines/windows/reset-network-interface
Create a deny internet outgoing rule on the network security group and attach it to the VM network adapter.
https://blogs.msdn.microsoft.com/igorpag/2016/05/14/azure-network-security-groups-nsg-best-practices-and-lessons-learned/
You may have to create allow rules for Azure storage for outbound traffic for VM agent to work.

Azure SQL Server Add Virtual Network

Im trying to Add existing virtual network on the screenshot above in Azure, but when I select the Subscription, the virtual network I want to connect to does not show up.
I had a google but couldn't find much to help, can anyone help me understand why my azure vnet cannot be attached at the moment and what needs to be changed on it to allow me to add it?
Virtual Network Rule has some limitations, you need to make your environment does not contain any of the following:
You can only add virtual network which has the same geographic region with your Azure logical SQL server. For example, if my logical SQL server is in Southeast Asia but my virtual network in East US then I will not be able to see it listed when adding a rule.
Rule can only be applied with Azure Resource Manager.
Rules cannot be applied with S2S VPN or ExpressRoute.
Moreover, to fully utilize virtual network rule, you need to also enable Microsoft.SQL service endpoint on your subnet. Click Service endpoints > Add. Choose service and subnet you want to enable service endpoint. Currently (as of this answer) only Storage and Azure SQL are available. Note that this is not actually required to do here, when adding existing virtual network (from logical server) you are given an option to enable service endpoint.

How to associate Network Security Group to a Ubuntu Classic VM in Azure?

I created a VM without assigning a Network Security Group. Now, I am trying to assign the one group thats already created to the VM but the group is not listed for assignment.
You only need click Network security group, then you could see your Network Security Group.
Note: Your VM is a classic VM, you only could see classic network security group.

Secure RDP and other endpoints in Azure

So we are starting to move to the cloud and our biggest concern is security, as it should be. The thing that I am not sure about is how to secure the end points from public (interent) access? Is this even possible or is there something else we can do to keep the environments in Azure out of the public eye?
This question is likely better suited to server fault. But until then...
In Azure IaaS V1, you can specify IP based ACLs (access control lists) to restrict inbound traffic.
In both IaaS v2, you can leverage NSG (network security groups) to help restriction trick into and out of specific VMs or virtual network sub-nets.
If you are using Azure Express Route (a leased line into an Azure facility), the VMs can be addressed directly from within the virtual network connection and don't need to have publically exposed endpoint.
Then there's also all the usual options such as securing the connections on the VMs themselves. :)
If you are using Azure Resource Groups along with your VMs (which is available on the new portal) you cannot use endpoints because it's not available there, so you should do the following to open up the HTTP port or ANY other port:
(Sign in to your account on the new portal)
1- Select the VM that you want to manage ports on.
2- In settings, click on Network Interfaces and select your network.
3- Go to Network Security Group and select your group.
4- Add Inbound or Outbound security rules depending on what you need.

no option to add affinity group to virtual network azure

The option to specify an affinity group when creating a virtual network in azure seems to have disappeared from the form. I can still attach to a location though. How do I get this option back.
Hello Dear,
This option have intentionnaly been replaced by the Region/Location as you said.
Regional Virtual Networks are supposed to be more appropriate than affinity groups.
For more information, you can go here : http://azure.microsoft.com/blog/2014/05/14/regional-virtual-networks/
Obviously, if you still want to bring back the Affinity group, then try this:
Create a Virtual Network from the Management Portal
Download the Virtual Network Configuration File
Edit the appropriate file section to get
<VirtualNetworkSitename="VNetDemo" AffinityGroup="VNetDemoAG">
instead of
<VirtualNetworkSitename="VNetUSWest" Location="West US">
Then, delete the previously created virtual network and import your file in the management portal to recreate the network with your defined settings.
Microsoft released Regional VNETs at Tech ED 2014. A Regional VNET is created on a region rather than an affinity group. Eventually, all existing Affinity Group VNETs will be migrated to be Regional VNETs. Since Regional VNETs provide significantly enhanced capabilities all new VNETs should be Regional VNETs and there is no reason whatsoever to create an Affinity Group VNET. That is presumably why you can no longer create Affinity Group VNETs in the Azure Portal.
New features include: Internal Load Balancer, Public Instance-Level Public IP Addresses, VNET-VNET connections, etc.

Resources