天天看點

【Azure 雲服務】檢視Azure雲服務在中國區域的VM型号大小清單(型号編碼,定價層,以及CPU, Memory等)

問題描述

如何檢視建立 Azure Cloud Service 服務時,可以選擇的VM型号嗎?

問題解答

根據官網參考,可以通過PowerShell腳本 Get-AzComputeResourceSku 列出所有的VM SKU,并且根據所選區域參數 $location = 'ChinaNorth2' ,過濾出目前區域可選的VMlist。 

PowerShell代碼如下:

#登入中國區Azure環境      

      Connect-AzAccount -Environment AzureChinaCloud

# Update the location
    $location = 'ChinaNorth2'
    # Get all Compute Resource Skus
    $allSkus = Get-AzComputeResourceSku
    # Filter virtualMachine skus for given location
    $vmSkus = $allSkus.Where{$_.resourceType -eq 'virtualMachines' -and $_.LocationInfo.Location -like $location}
    # From filtered virtualMachine skus, select PaaS Skus
    $passVMSkus = $vmSkus.Where{$_.Capabilities.Where{$_.name -eq 'VMDeploymentTypes'}.Value.Contains("PaaS")}
    # Optional step to format and sort the output by Family
    $passVMSkus | Sort-Object Family, Name | Format-Table -Property Family, Name, Size      

以上腳本檢視到的結果顯示如下:

【Azure 雲服務】檢視Azure雲服務在中國區域的VM型号大小清單(型号編碼,定價層,以及CPU, Memory等)

 如果想檢視這個系列的CPU, Memory資料,可以擷取 Capabilities 屬性中的vCPUs 和 MemoryGB 資料。

【Azure 雲服務】檢視Azure雲服務在中國區域的VM型号大小清單(型号編碼,定價層,以及CPU, Memory等)

Get-Member 檢視PowerShell對象資料結構:

【Azure 雲服務】檢視Azure雲服務在中國區域的VM型号大小清單(型号編碼,定價層,以及CPU, Memory等)

參考資料

Azure 雲服務(外延支援)的可用大小 : https://docs.azure.cn/zh-cn/cloud-services-extended-support/available-sizes#get-a-list-of-available-sizes

Resource Skus - List : https://docs.microsoft.com/zh-cn/rest/api/compute/resource-skus/list

當在複雜的環境中面臨問題,格物之道需:濁而靜之徐清,安以動之徐生。 雲中,恰是如此!

繼續閱讀