Skip to main content
added 109 characters in body
Source Link
Amit Baranes
  • 8.2k
  • 2
  • 39
  • 61

The easiest way to pass variables to any CLI command is by using environment variables

An environment variable is a variable whose value is set outside the program, typically through a functionality built into the operating system or microservice. An environment variable is made up of a name/value pair, and any number may be created and available for reference at a point in time.

ExampleBelow you can find examples in bashBash and CMD:

Set new environment variable-Bash-

Set new environment variable-

export LOCATION=westeurope

Print the environment variable- Print the environment variable-

echo ${LOCATION}

AZ CLI example- AZ CLI example-

az group create --name foo --location ${LOCATION}

Example in CMD:CMD-

Set new environment variable-

set LOCATION=westeurope

Print the environment variable-

echo %LOCATION%

AZ CLI example-

az group create --name foo --location %LOCATION%

The easiest way to pass variables to any CLI command is by using environment variables

An environment variable is a variable whose value is set outside the program, typically through a functionality built into the operating system or microservice. An environment variable is made up of a name/value pair, and any number may be created and available for reference at a point in time.

Example in bash:

Set new environment variable-

export LOCATION=westeurope

Print the environment variable-

echo ${LOCATION}

AZ CLI example-

az group create --name foo --location ${LOCATION}

Example in CMD:

set LOCATION=westeurope
echo %LOCATION%
az group create --name foo --location %LOCATION%

The easiest way to pass variables to any CLI command is by using environment variables

An environment variable is a variable whose value is set outside the program, typically through a functionality built into the operating system or microservice. An environment variable is made up of a name/value pair, and any number may be created and available for reference at a point in time.

Below you can find examples in Bash and CMD:

Bash-

Set new environment variable-

export LOCATION=westeurope

Print the environment variable-

echo ${LOCATION}

AZ CLI example-

az group create --name foo --location ${LOCATION}

CMD-

Set new environment variable-

set LOCATION=westeurope

Print the environment variable-

echo %LOCATION%

AZ CLI example-

az group create --name foo --location %LOCATION%
added 159 characters in body
Source Link
Amit Baranes
  • 8.2k
  • 2
  • 39
  • 61

The easiest way to pass variables to any CLI command is by using environment variables

An environment variable is a variable whose value is set outside the program, typically through a functionality built into the operating system or microservice. An environment variable is made up of a name/value pair, and any number may be created and available for reference at a point in time.

Example in bash:

Set new environment variable-

export LOCATION=westeurope

Print the environment variable-

echo ${LOCATION}

AZ CLI example-

az group create --name foo --location ${LOCATION}

Example in CMD:

set LOCATION=westeurope
echo %LOCATION%
az group create --name foo --location %LOCATION%

The easiest way to pass variables to any CLI command is by using environment variables

An environment variable is a variable whose value is set outside the program, typically through a functionality built into the operating system or microservice. An environment variable is made up of a name/value pair, and any number may be created and available for reference at a point in time.

Example in bash:

Set new environment variable-

export LOCATION=westeurope

Print the environment variable-

echo ${LOCATION}

AZ CLI example-

az group create --name foo --location ${LOCATION}

The easiest way to pass variables to any CLI command is by using environment variables

An environment variable is a variable whose value is set outside the program, typically through a functionality built into the operating system or microservice. An environment variable is made up of a name/value pair, and any number may be created and available for reference at a point in time.

Example in bash:

Set new environment variable-

export LOCATION=westeurope

Print the environment variable-

echo ${LOCATION}

AZ CLI example-

az group create --name foo --location ${LOCATION}

Example in CMD:

set LOCATION=westeurope
echo %LOCATION%
az group create --name foo --location %LOCATION%
Source Link
Amit Baranes
  • 8.2k
  • 2
  • 39
  • 61

The easiest way to pass variables to any CLI command is by using environment variables

An environment variable is a variable whose value is set outside the program, typically through a functionality built into the operating system or microservice. An environment variable is made up of a name/value pair, and any number may be created and available for reference at a point in time.

Example in bash:

Set new environment variable-

export LOCATION=westeurope

Print the environment variable-

echo ${LOCATION}

AZ CLI example-

az group create --name foo --location ${LOCATION}