Code sync from Azure Scale Set VM To Azure Storage

|▌冷眼眸甩不掉的悲伤 提交于 2021-02-11 15:17:07

问题


I need help to rectify one trouble which i am facing, am hosting my application through Azure auto scale set feature (virtual machine scale set) , when it get huge hit it will automatically scale up and an reverse when hit down, for that i need to maintain a azure storage location as well, so while push the code i need to push the similar code to azure storage from one of the VM , if we have fixed VM name we can use azcopy to push code to azure store but since its auto scale i don't have particular VM name.

simply for eg, currently there is 100 scale set servers/vm's are in pool i need to push code to azure storage from one of the server from that 100 and i dont have any particular name for that servers, how does it possible ??? condition is only one time i have push code to storage from one server.


回答1:


You can just use this PS command :

Get-AzVmssVM -ResourceGroupName <resource group name> -VMScaleSetName <VMSS name>

To get all instance names so that you can perform your copy logic. And refer to this post to retry the whole process in case of the instance that you picked get deleted while you copying data by your scaling rules.

If you want to get 1 VM from the VM list, you can just get the first one in the list as below:

$destVM = (Get-AzVmssVM -ResourceGroupName <group name> -VMScaleSetName <vmss name>)[0]



来源:https://stackoverflow.com/questions/64881572/code-sync-from-azure-scale-set-vm-to-azure-storage

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!