簡體   English   中英

Azure 來自運行 CentOS 的 VM 的環境檢測

[英]Azure Environment detection from VM running CentOS

我們有一個要求,我們需要從 CentOS 實例了解給定的 VM 是在 Azure 還是 Hyper-V 上運行。 我們嘗試使用 dmidecode 來查看它們是否有任何有助於提供此信息的信息。 不幸的是,兩者的 dmidecode 是相同的,唯一的區別似乎是 UUID 和序列號。任何有關查找此信息的替代方法的建議都將受到歡迎。 謝謝和問候 - 馬赫什

From Azure VM the Azure VM metadata endpoint is accessible and curl to that endpoint will respond with VM metadata json curl -H Metadata:true --noproxy "*" "http://169.254.169.254/metadata/instance?api-version=2020-09-01" ,如https: //docs.microsoft.com/en-us/azure/virtual-machines/linux/instance-metadata-service 中所述。 如果 VM 不是 Azure VM,則無法訪問此端點,並且 curl 將響應錯誤。 這可以用來區分VM是否是Azure VM

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM