如何通过Get-AzureRmAppServicePlan检索workerSize [英] How do I retrieve the workerSize via Get-AzureRmAppServicePlan
问题描述
当通过Azure PowerShell cmdlet New-AzureRmAppServicePlan
创建新的AppServicePlan时,期望我添加 WorkerSize
,例如Small,Medium或Large.例如:
When creating a new AppServicePlan via the Azure PowerShell cmdlet New-AzureRmAppServicePlan
, it is expected for me to add a WorkerSize
such as Small, Medium or Large. For example:
$appServicePlanSettings = @{
Name = "testingServicePlan";
Location = "westeurope";
Tier = "Basic";
ResourceGroupName = "testingResourceGroup";
NumberofWorkers = 1;
WorkerSize = "Medium";
}
New-AzureRmAppServicePlan @appServicePlanSettings
但是,当我通过 Get-AzureRmAppServicePlan
检索相同的AppServicePlan时,我找不到此信息.相反,我遇到了 Sku
属性,该属性包含一个 Size
属性,例如,值为B2,指示WorkerSize为中等.示例:
However, when I retrieve this same AppServicePlan via Get-AzureRmAppServicePlan
, I am unable to find this information. Instead I come across the Sku
property, which contains a Size
property with for example the value B2, indicating the WorkerSize was medium. Example:
> $plan = Get-AzureRmAppServicePlan -Name "testingServicePlan" -ResourceGroupName "testingResourceGroup"
> $plan.Sku
Name : B2
Tier : Basic
Size : B2
Family : B
Capacity : 1
如果我想比较等效值,是否应该在HashList中跟踪这些转换,或者是否有其他方法可以检索"Medium"?我可能错过了一些东西,但找不到此信息.
Am I supposed to keep track of these conversions in for example a HashList if I want to be able to compare the equivalent values, or is there some other way for me to retrieve the 'Medium'? I might have missed something but couldn't find this information.
根据PowerShell的 GetType()
方法,返回的对象是 ServerFarmWithRichSku
,其基本类型为 Microsoft.Azure.Management.WebSites.Models.Resource
,但是我缺少进一步了解该对象的文档
According to PowerShell's GetType()
method, the object returned is a ServerFarmWithRichSku
, with as base type Microsoft.Azure.Management.WebSites.Models.Resource
, but the documentation for this object was a bit lacking for me to get any further
推荐答案
我在实验室中进行了测试, $ plan.Sku.size
是 WorkerSize
的值.结果如下.
I test in my lab, $plan.Sku.size
is WorkerSize
value. The following is the result.
SMALL
Name : B1
Tier : Basic
Size : B1
Family : B
Capacity : 1
Medium
Name : B2
Tier : Basic
Size : B2
Family : B
Capacity : 1
Large
Name : B3
Tier : Basic
Size : B3
Family : B
Capacity : 1
我同意Sridharan,但最好使用如下脚本:
I agree with Sridharan, but you had better use script like below:
$hash = @{}
$hash['B1'] = "Small"
$hash['B2'] = "Medium"
$hash['B3'] = "Large"
$hash['B4'] = "Extra Large"
$plan = Get-AzureRmAppServicePlan -Name "testingServicePlan" -ResourceGroupName "testingResourceGroup"
$val=$plan.Sku.Size
echo $hash[$val]
这篇关于如何通过Get-AzureRmAppServicePlan检索workerSize的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!