0
votes

I have created a few environment variables in my Linux VM hosted in Azure. The environment variables reside in ~/.profile file.

The variables are:

admin_user=heroadmin
export admin_user
admin_password=heropassword
export admin_password
admin_secret=0987heroSecret

The variables will be retrieved in a java class. Using the environment variable, I will call RESST endpoints using the above environment variables retrieved via [System.getenv("admin_user")]

I read somewhere that when I deprovision and create image all the changes and files will be lost.

If I deprovision the virtual machine and create scale set with multiple instances from the virtual machine image, Will I be able to get environment variables in my scale set instances?

I do not want to set environment variables manually in each instance as auto-scaling is enabled in scale set, so new VM instances get created frequently.

1

1 Answers

1
votes

no, you'd need to use some sort of startup script (like Azure VM Script extension) to populate those keys\values for the VMSS. VMSS images come up from the golden image you specified when you created VMSS and they do not contain changes you manually applied to them.