I am running a Powershell command to extract an IP from a Azure container group (ACI)
my output contains the data like this (access lines have been removed)
DnsConfigNameServer :
DnsConfigOption :
DnsConfigSearchDomain :
EncryptionPropertyKeyName :
IPAddressDnsNameLabel :
IPAddressFqdn :
IPAddressIP : 10.131.1.4
IPAddressPort : {{
----
By running the below command I have managed to get the IP address from the output. However, the command result provides the whole line.
Get-AzContainerGroup -Name test-aci-01 -ResourceGroupName tot-RG | Format-List | Out-String -Stream | Select-String -Pattern "IPAddressIP"
IPAddressIP : 10.131.1.4
I only need the IP address. So the output should be
10.131.1.4
To simplify the question, I have stored the results in the variable.
$myipaddress=Get-AzContainerGroup -Name test-aci-01 -ResourceGroupName tot-RG | Format-List | Out-String -Stream | Select-String -Pattern "IPAddressIP"
$myipaddress
IPAddressIP : 10.131.1.4
Can anyone help please?
Thanks