Setting Up Env Variables on Linux, and uploading them to a Linux VM On Azure

First let’s set up your env variables locally on your Linux machine, and then I’ll show you guys a trick that makes it incredibly easy to set it up to a remote virtual machine.

  • First move to the directory that holds your profile file

      $ cd
  • • Then do a ls –a to find which one of these files you have. ( .profile, .bash_profile, .bashrc)

      $ ls –a
  • Depending on which one you have you want to open it up with sudo and nano

      $ sudo nano .profile
      $ sudo nano .bash_profile
      $ sudo nano .bashrc
  • If you do not have any of them (do look carefully because this is rare) then go ahead and use the .profile one and it will be created for you.

  • Once you do this a nano screen with information about your system. This information will vary depending on the type of profile that you have (.profile, bash , bashrc)


  • In between the opening and closing “fi” tags, you want to include your environmental variables in the following format

      export variable="value"
      export APPLICATIONID="132415848"
      export APPLICATIONID2="132125415848"
  • Once that is done save your changes and make sure to copy these environmental variables so we can reuse them on you Cloud VM. Close out of nano.

  • Now close out of the command line and restart it. Sometimes you might need to restart your computer. Your environment variables are now set up for your Linux virtual machine.

  • In order to get these set up on your Remote VM, head over to and log in with your user account.

  • Select your Virtual Machine from the Virtual Machine List, and select dashboard

visual dashboard

  • Copy your public ip address

public ip


  • Log in to your server and type “cd”

  • Now to an ls –a and look for ( .profile, .bash_profile, .bashrc )

  • Depending on which one you have type the following:

    $ sudo nano .profile
    $ sudo nano .bash_profile
    $ sudo nano .bashrc

  • Now when nano pops up you don’t have do to everything all over again. All you need to do is copy the text you had previously saved, navigate to between the two li’s, and press your mouse’s right button which will cause it to copy your data into the .profile file. Now go ahead and save and close out of nano.

  • Disconnect and reconnect to putty in order to reset the command line variables and you are now done.

Paulo Diniz