0

Is there any way to use the KV REST API and have a static outbound IP address?

I have a dockerised programme running in an Azure Container Instance (ACI). It's a standalone container – no cluster. I have 2 requirements that seem to be in conflict:

  1. Read and write to a Key Vault
  2. Make selects on a DB hosted on Google Cloud

Yes I have part of the solution in Azure and part in Google. There's a genuine reason for this.

Read and write to a Key Vault I've programmed in Ruby, so I'm using the REST API to access the KV. The first step of this is making a request to the Instance Metadata Service (IMS) to get an authorization token, on http://169.254.169.254/metadata/identity/oauth2/token. This worked great until I added an Azure Firewall.

Make requests to a DB hosted on Google Cloud Google Cloud requires that I specify the external IP address making selects. ACI doesn't provide a static outbound IP address. The solution to get a static address seems to be an Azure Firewall.

Firewall problem – Application Rules The firewall requires that I add one or more Application Rules to enable the programme to make outbound requests. These rules are qualified by a fully qualified domain name (FQDN), not an IP address. When I try to connect to the IMS, my connection times out with the following Ruby error details:

  • Error class: Net::OpenTimeout
  • Error message: Failed to open TCP connection to 169.254.169.254:80 (execution expired)

I have tried 169.254.169.254 as an FQDN. Same outcome.

There are 3 other destination types: FQDN Tag, Web Categories (for web content firewalls) and URL (premium accounts only). I don't think any of these would help me.

Thanks, Guy

guy
  • 72
  • 6
  • Azure documentation at https://learn.microsoft.com/en-us/azure/virtual-machines/instance-metadata-service?tabs=windows says: "IMDS is a REST API that's available at a well-known, non-routable IP address (169.254.169.254)." and "The Instance Metadata Service is only accessible from within a running virtual machine instance on a non-routable IP address. VMs can only interact with their own metadata/functionality. The API is HTTP only and never leaves the host." That suggests to me that IMDS requests cannot pass through the firewall. Do my requirements simply not work on Azure? – guy Jun 15 '23 at 09:50

0 Answers0