Specify service principal credentials in environment variables
Once you create a service principal, you can specify its credentials to Terraform via environment variables.
Edit the
~/.bashrc
file by adding the following environment variables.BashCopy
To execute the
~/.bashrc
script, runsource ~/.bashrc
(or its abbreviated equivalent .~/.bashrc
). You can also exit and reopen Cloud Shell for the script to run automatically.BashCopy
Once the environment variables have been set, you can verify their values as follows:
BashCopy
Using PowerShell:
To set the environment variables within a specific PowerShell session, use the following code. Replace the placeholders with the appropriate values for your environment.
PowerShellCopy
Run the following PowerShell command to verify the Azure environment variables:
PowerShellCopy
To set the environment variables for every PowerShell session, create a PowerShell profile and set the environment variables within your profile.
Last updated