The content is bash script but it showed 'Azure CLI'. Please advise.

Chung Yeung NG 20 Reputation points
2025-03-21T16:08:27.95+00:00

The cell is bash script rather than Azure CLI. Please see attached photo for your reference. please advise.

IPADDRESS="$(az vm list-ip-addresses --resource-group "learn-a29b51b3-13a5-45e3-bcc3-3319fbd1f9c1" --name my-vm --query "[].virtualMachine.network.publicIpAddresses[*].ipAddress" --output tsv)"

This question is related to the following Learning Module

Azure Azure Training
0 comments No comments
{count} votes

Accepted answer
  1. Divyesh Govaerdhanan 6,235 Reputation points
    2025-03-22T14:21:15.84+00:00

    Hello,

    Welcome to Microsoft Q&A,

    You're right — the command you're referring to is a bash script:

    IPADDRESS="$(az vm list-ip-addresses --resource-group "learn-xxxxxxxx" --name my-vm --query "[].virtualMachine.network.publicIpAddresses[*].ipAddress" --output tsv)"
    

    🔹 The Bash script that embeds an Azure CLI command using command substitution ($(...)) to store the VM's public IP address in a variable.

    Please Upvote and accept the answer if it helps!!

    1 person found this answer helpful.
    0 comments No comments

1 additional answer

Sort by: Most helpful
  1. VarunTha 14,850 Reputation points Microsoft External Staff Moderator
    2025-03-25T16:28:39.31+00:00

    Hi Chung Yeung NG,
    Thank you for reaching out to us on the Microsoft Q&A forum.

    The script that you posted is actually a Bash script using Azure CLI commands to get the public IP address of a virtual machine. Although written in Bash, it uses Azure CLI specifically to work with Azure resources. It is because of this reason that it can sometimes look like 'Azure CLI' content, despite the Bash syntax.

    If you have any other questions or require further clarification, please don't hesitate to ask!

    If you have found the answer provided to be helpful, please click on the "Accept answer" button so that it is useful for other members in the Microsoft Q&A community.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.