Hello Tim Dadd
Welcome to Microsoft Q&A Platform, thanks for posting your query here.
Based on the issue description you shared, looks like you are trying to deploy two Azure Container Instances (ACIs) and connect them to a PostgreSQL database that is hosted on a virtual network.
To connect to the PostgreSQL database, you need to create a private endpoint on the virtual network and associate it with the PostgreSQL server.
What am I doing wrong - why when I create the ACI am I not offered the default subnet of the VPN?
Regarding the issue with the default subnet not being available when creating the ACI, it could be because the subnet is already in use by another resource. You can try creating a new subnet and delegating it to Microsoft.DBforPostgreSQL/flexibleServers.
All I want is two ACIs and the database on one virtual network with public access to the http on port x of the client ACI.
To deploy two ACIs and a PostgreSQL database on one virtual network with public access to the HTTP on port x of the client ACI, you can follow these steps:
- Create a virtual network and a subnet for the ACIs and the PostgreSQL server. You can use the Azure portal or Azure CLI to create the virtual network and subnet. Make sure that the subnet is delegated to Microsoft.DBforPostgreSQL/flexibleServers.
- Create a PostgreSQL server on the virtual network. You can use the Azure portal or Azure CLI to create the server. When creating the server, make sure that you select the virtual network and subnet that you created in step 1.
- Create two ACIs, one for the business logic server and one for the client. You can use the Azure portal or Azure CLI to create the ACIs. When creating the ACIs, make sure that you select the virtual network and subnet that you created in step 1.
- Create a public IP address for the client ACI. You can use the Azure portal or Azure CLI to create the IP address. When creating the IP address, make sure that you select the client ACI as the associated resource.
- Create a network security group (NSG) for the client ACI. You can use the Azure portal or Azure CLI to create the NSG. When creating the NSG, make sure that you allow inbound traffic on port x.
- Associate the NSG with the client ACI. You can use the Azure portal or Azure CLI to associate the NSG with the client ACI.
- Connect to the PostgreSQL server from the business logic server ACI using the private endpoint.
- Configure the business logic server to listen on port x and expose it to the client ACI.
With these steps, you should be able to deploy two ACIs and a PostgreSQL database on one virtual network with public access to the HTTP on port x of the client ACI.
Hope this helps.