Hello Waqar Ahmad,
Welcome to the Microsoft Q&A and thank you for posting your questions here.
I understand that you are having issues finding your private IP Address: Log Analytics Webspace against ContainerInstanceLogs has no entry Container IP.
To find the private IP address of your Azure Container Instance (ACI) and set up an alert for IP changes upon restart, you can use the Azure CLI and Azure portal. First, open Azure Cloud Shell from the Azure portal by clicking on the Cloud Shell icon at the top of the page. Then, run the following command to retrieve the private IP address of your container instance:
az container show --name <your-container-name> --resource-group <your-resource-group> --query ipAddress.ip --output tsv
Replace <your-container-name>
and <your-resource-group>
with the actual names of your container and resource group. This command will output the private IP address of your container instance.
The NEXT, to set up an alert for your ACI to notify you if the IP changes upon restart, follow these steps:
- Create an Alert Rule for Container Restart:
- Go to the Azure portal and navigate to your container instance.
- Select Alerts from the container blade.
- Click on Create Alert Rule.
- Under the Scope section, ensure your container instance is selected.
- Click Add Condition and select the Restart Container Group signal.
- Click Done.
- Add Action Groups:
- Under Actions, click Add Action Groups.
- Select the subscription and resource group.
- Configure the notification settings (e.g., email, SMS) and click Next: Notifications.
- Review and create the alert rule.
- Use Azure Log Analytics to monitor the IP address. Ensure your container logs are being sent to Log Analytics and create a query in Log Analytics to check the IP address of your container instance:
ContainerInstanceLog
| where TimeGenerated > ago(1h)
| project TimeGenerated, IPAddress
Set up an alert based on this query to notify you if the IP address changes.
- If you need a static IP for your container instance, consider deploying your ACI in a virtual network and using a static IP configuration. This can be done by setting up a user-defined route and using Azure Firewall or NAT gateway.
I hope this is helpful! Do not hesitate to let me know if you have any other questions.
Please don't forget to close up the thread here by upvoting and accept it as an answer if it is helpful.