How to limit access to a container running in container instance?

Anonymous
2021-03-17T20:21:19.81+00:00

I'm using "container instances" to run a simple container. During creation I can choose "public", which makes the container publicly accessible. This works, but in my use case it would be better to restrict access to that container on one specific IP and I don't know how to achieve this. Any help is highly appreciated here.

Azure Container Instances
Azure Container Instances
An Azure service that provides customers with a serverless container experience.
757 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. AirGordon 7,150 Reputation points
    2023-05-16T09:24:45.1+00:00

    In order to still expose the container, but control the IP's that are allowed access you will need to redeploy using the Virtual Network deployment feature : https://learn.microsoft.com/en-us/azure/container-instances/container-instances-vnet

    Once the container instance is running in a Virtual Network, you can create a Network Security Group which will allow you to specify your IP rules.
    Now that you have a privately running container, you just need to access it.

    1. This could be done privately through peering the Virtual Network to another Network which has connectivity to your client app/workstation.
    2. It could be to the internet, exposed via another Azure service.
      For some example scenarios, see;
      App GW : https://learn.microsoft.com/en-us/azure/container-instances/container-instances-application-gateway
      Azure Firewall : https://learn.microsoft.com/en-us/azure/container-instances/container-instances-egress-ip-address
    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.