简体   繁体   English

是否将环境变量传递到根据已取消标准的Azure VM(Linux)映像创建的新比例尺实例

[英]Does environment variables get passed to new scale set instances created from deprovisoned azure vm(linux) image

I have created a few environment variables in my Linux VM hosted in Azure. 我在Azure托管的Linux VM中创建了一些环境变量。 The environment variables reside in ~/.profile file. 环境变量位于〜/ .profile文件中。

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. 变量将在Java类中检索。 Using the environment variable, I will call RESST endpoints using the above environment variables retrieved via [ System.getenv("admin_user") ] 使用环境变量,我将使用通过[ System.getenv(“ admin_user”) ]检索的上述环境变量来调用RESST端点。

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. 我不想在每个实例中手动设置环境变量,因为在比例设置中启用了自动缩放功能,因此经常创建新的VM实例。

no, you'd need to use some sort of startup script (like Azure VM Script extension) to populate those keys\\values for the VMSS. 否,您需要使用某种启动脚本(如Azure VM脚本扩展名)来填充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. VMSS映像来自您在创建VMSS时指定的黄金映像,并且它们不包含您手动应用于它们的更改。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM