[英]Get the Sku of Azure automation account
I am trying to enable diagnostic settings on existing automation accounts in different subscriptions. 我试图在不同订阅中的现有自动化帐户上启用诊断设置。
So far my script exist out of the following topics. 到目前为止,我的脚本不属于下列主题。
Deploy the ARM template that enable diagnostic settings on that specific automation account. 部署用于在该特定自动化帐户上启用诊断设置的ARM模板。
{ "name": "[parameters('AutomationAccountName')]", "type": "Microsoft.Automation/automationAccounts", "apiVersion": "2015-10-31", "properties": { "sku": { "name" : "Basic" } }, "location": "[parameters('location')]", "resources": [ { "type": "providers/diagnosticSettings" Enabling all sort of logs in the diagnostic settings ..
This works fine. 这很好。 But the problem I am facing right now is that the sku is set to basic right here.
但是我现在面临的问题是,此处的sku设置为基本。 But I can't be sure that is the case to every single automationaccount I retrieve with the get-AzAutomationAccount command.
但是我不确定使用get-AzAutomationAccount命令检索的每个自动化帐户都是这种情况。
I have searched to get the plan value from the get-AzAutomationAccount and save this inside the ARM template but seems to be empty. 我已经从get-AzAutomationAccount中获取计划值并将其保存在ARM模板中,但似乎为空。
Is there any other way to retrieve the sku of each Azure Automation account. 还有其他方法可以检索每个Azure自动化帐户的sku。
ALSO the SKU object normally is not required if I read the official doc of Microsoft . 如果我阅读Microsoft的官方文档,通常也不需要SKU对象。 But whenever I delete the sku object or leave it empty the deployment fails.
但是,每当我删除sku对象或将其保留为空时,部署就会失败。
Is there anyone who know how to fix this ? 有谁知道如何解决这个问题?
The command Get-AzAutomationAccount
will not return the sku
property, it just returns the Plan
. 命令
Get-AzAutomationAccount
将不会返回sku
属性,而只会返回Plan
。
If you want to get the sku
, you could use the command as below. 如果要获取
sku
,可以使用以下命令。
$sku = (Get-AzResource -ResourceGroupName "<resource group name>" -ResourceType Microsoft.Automation/automationAccounts -ResourceName "<automation account name>").properties.sku
$sku | ConvertTo-Json
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.