Azure / Azure/azure-cli

Dynamically retrieve correct IP address

Open
#14,928 5 comments 0 reactions 0 assignees View on GitHub
act-observability-squad Container Instances customer-reported needs-team-attention Service Attention
Dominant language
Python
Stars
4.6k
Forks
3.5k
Avg merge
3d 2h
Merged PRs (30d)
60

Description

When I create a container it shows the ip address. I can retrieve that ip address with the below command.

```bash
cmd="az container show \
-n $CONTAINER \
--query ipAddress.ip \
-o tsv \
-g $RG"
```
The problem is, that is not the ip address under which the container actually runs. When checking container logs in azure portal, I see the error that says the server is trying to connect to my database under a different ip. I need that ip to be able to configure server firewall.

ip at creation 52.XXX.XXX.X
ip at runtime 65.xx.xxx.xxx

```bash
az sql server firewall-rule create \
-g $DB_RG \
-s $DB_SERVER \
-n $FIREWALL_RULE \
--start-ip-address $IP \
--end-ip-address $IP

```

How to retrieve the correct ip dynamically so it can be set in create-container script?

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.