Azure ARM VM creation with Network Security Groups - azure

I have a network with enabled Network Security Groups where I deny Outbound Port 80 and 443. All Outbound traffic is managed through a Squid Proxy.
Now, I want to create a new Virtual Machine in this Network using the Azure ARM templates using the resource Microsoft.Compute/virtualMachines. The problem is that after creation of the Azure Storage Account the VM can't connect to it as the Outbound Port 80 and 443 are denied.
Is it possible to give the resource Microsoft.Compute/virtualMachines some proxy settings?

You'll need to use a custom script extension to call a script to change the proxy settings on the VM itself after VM creation has completed.

Related

How to close a port 8010 on Azure App service

I need to close a port 8010 on one of my app service on Azure. Is it possible to configure ports on app service?
In the App Service shared tenant environment, it is not possible to block specific ports because of the nature of the infrastructure.
But in App Service Environment(ASE), you have full control over inbound and outbound traffic. You can use Network Security Groups to restrict or block specific ports.
An ASE always exists in a virtual network, and more precisely, within a subnet of a virtual network. You can use the security features of virtual networks to control inbound and outbound network communications for your apps.
So, you need to create app service, virtual network. Then deploy app service to virtual network. (The vnet applies asg rules)
follow steps:
1.create a virtual network and make sure it is in the same location with your app service.
2.create a network secure group.(also make sure in the same location, In my side all of location is 'Central US')
3.add security rules of your nsg. Inbound or Outbound.
3.create a subnet in the vnet. Use the network secure group that you create above.
4.deploy your app service to the subnet of virtual network that you create above.
Finally, the app service deploy to the subnet of virtual network and the subnet virtual network use the network secure group which blocks specific ports. So your app service also block specific ports.
Please let me know if you have more problems.

Can't access Azure VM HTTP Web Site from Outside of Azure

I've setup a VM and installed IIS. I checked that the firewall rules were enabled for HTTP and HTTPS. Furthermore, in Azure Portal, I've enabled the two predefined inbound security network group rules for HTTP and HTTPS.
When in the VM, I can go to localhost and see the default Web page of IIS Default Web Site.
Inbound security rule in Network Security Group
Anybody know how to go about figuring out how to make this work?
Thx
You should add port 443 and port 80 to azure VM windows firewall inbound rules.
Are the Source port ranges on your inbound rules set to 80/443 or * (i.e. all source ports)?
Try changing them to * with only the destination ports set to 80 or 443 respectively.
Ex:
Refer How to open ports to a virtual machine with the Azure portal for more details.
There are two ways to make your site accessible from the Internet.
Use the public IP address which is associated to the virtual machine's NIC.
Configure DNS for your VM machine (e.g. web.southeastasia.cloudapp.azure.com). This DNS is bounded to the associated public IP Address.
Reference: https://learn.microsoft.com/en-us/azure/virtual-machines/windows/portal-create-fqdn
In your IIS, just configure binding to make sure the incoming request from the Internet is recognized by IIS.
You also need to make sure you have no rule in Network Security Group (NSG) blocking port 80. Or if there is a NSG, you need to create an inbound rule to allow port 80.
I Azure Windows VM, apart from configuring the NSG rule, we should also create a Windows firewall rule to allow inbound TCP connections on the required port. Just RDP into your windows VM, open Windows Defender Firewall and add the rule

Can I create white list for Azure Web App service?

I have web api and SQL Server VM. I would like to configure inbound of virtual network so that TCP port 80 traffic is allowed only from Web API, but how?
Is it really so must to add (automatically) 50+ IP address to Inbound rules of Network security group to allow Any access to 1433?

open port on azure while logged onto azure vm

I want to open a port on Azure. I am logged onto Azure VM. After that how to do I open the port?
I tried opening the firewall port but that did not help. I also tried to do it thru azure-cli but it needs web login.
Can I not open a port while logged in onto that Azure VM?
For VMs in azure service management mode:
To open a particular port, say 8080 in your VM, you have to add an endpoint in azure portal, powershell or using xplat-cli. Once this is done, you have created a connectivity between external loadbalancer (I mean VIP of the VM) to the actual VM (with Internal IP address). If the VM is Linux, by default you can start using endpoint (VIP and port) it unless you restrict ports specifically.
For windows VM, for non standard ports, you have to add windows firewall inbound allow rules (say for 8080) inside your VM so that it can accept traffic forwarded from VIP
For VMs in azure resource management:
You have to first create a loadbalancer with VIP, then add NAT rules to forward traffic from VIP to VM. (use load balancing rules if same VIP port forwards traffic to multiple backend VMs)
For windows VM, again windows firewall inbound rules needs to be added
Securing ports:
The above scenario will work by default, but if you want to secure your ports, you have to follow either one of the below, not both.
Use Access control List (ACL): This works at VIP endpoint level. If we want to restrict VIP port 8080 to only few Ip and deny other IP, we can use ACL to add those IPs. This can be done in portal endpoint section/powershell/Xplat-cli
Use Network Security Group (NSG): This works at pheriphery of VM level. We have greater control here to restrict multiple VM ports, port range, etc., but we have to manage those rules. The ports needs to be secured in NSG is the VM internal port whereas in ACL it is the VIP port.
Hope this clarifies
You also need to open the port in the Endpoint settings within the Azure Portal.
Go to Azure Portal -> Your VM -> Settings -> Endpoints and add your Port.
To open a port, you have to it from the azure portal and not in the VM. You can use the NSG (Network Security Group) attached to vm and add a rule in the "Inbound security rules"

Not able to access application hosted on Linux VM on Azure cloud

I have created a CentOS 7.1 VM using Resource Manager deployment model.
I am not able to access the application using a browser on a machine connected to internet.
However I am able to access the application on same machine and other VM on same virtual network using private IP address.
I configured Network Security Group and allowed port 80 and 443 in Inbound Rules.
Well, it turned out that I needed to open ports under "Inbound Security Rules" and needed to open all in "Source Port Range". For doing so, i needed to put * there and in Destination port for https - 443 etc.
This * thing was the catch which i was missing in all the Inbound security rules for allowing the ports.

Resources