Retrieve Inbound IP Address for a Azure App Service when using a Private Endpoint.

When we are using Bicep Script to configure Azure App Services in your environment and we are using Private Endpoint, the Inbound IP Address of the Azure App Service is the Private IPv4 Address of the NIC associated with the Private Endpoint. Below is the Bicep script that we need to use to get the Private IPv4 IP address using the Bicep Script.
//NICName - Replace the Nic Name with the name of the NIC from your environment. resource networkInterfacesResource 'Microsoft.Network/networkInterfaces@2023-09-01' existing = { name: NICName.nic' } //The IPv4 Address is part of the IP configuration of the NIC and the ipConfigurations is an array. Here in this example, we have only ipConfiguration associated with the NIC //so hard coding the array with the value 0 will work here. output IP string = networkInterfacesResource.properties.ipConfigurations[0].properties.privateIPAddress
Just for completeness sake, below is the Bicep script that you can use to get the Inbound IP address of a Azure App Service when you are not using a Private Endpoint.
resource appService 'Microsoft.Web/sites@2021-02-01' existing = { name: 'ZP-RL-APP-Test-DEV-CENTRALUS-01' } output inboundIpAddress string = appService.properties.inboundIpAddress

Comments

Popular posts from this blog

Print from WPF using ReportViewer Control

Printing SSRS 2008 R2 Reports from C#.

Using IOptions class in .Net Core Unit Testing.