Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/azure/11.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
获取Azure自动化帐户的Sku_Azure_Powershell_Azure Powershell_Arm Template - Fatal编程技术网

获取Azure自动化帐户的Sku

获取Azure自动化帐户的Sku,azure,powershell,azure-powershell,arm-template,Azure,Powershell,Azure Powershell,Arm Template,我正在尝试在不同订阅中的现有自动化帐户上启用诊断设置 到目前为止,我的脚本存在于以下主题之外 检索所有自动化帐户 通过每一个循环。 将ARM模板中参数的值更改为检索到的自动化帐户的值 部署在特定自动化帐户上启用诊断设置的ARM模板 { "name": "[parameters('AutomationAccountName')]", "type": "Microsoft.Automation/automationAccounts", "apiVers

我正在尝试在不同订阅中的现有自动化帐户上启用诊断设置

到目前为止,我的脚本存在于以下主题之外

检索所有自动化帐户 通过每一个循环。 将ARM模板中参数的值更改为检索到的自动化帐户的值 部署在特定自动化帐户上启用诊断设置的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 ..
这个很好用。 但我现在面临的问题是sku在这里设置为basic。但是我不能确定我用get-AzAutomationAccount命令检索到的每一个automationaccount都是这样

我已经搜索过从get-AzautomationaAccount获取计划值,并将其保存在ARM模板中,但似乎是空的

是否有其他方法检索每个Azure Automation帐户的sku

{
        "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 ..
此外,如果我读取,通常不需要SKU对象。但每当我删除sku对象或将其保留为空时,部署就会失败

有人知道如何解决这个问题吗?

命令Get-AzAutomationAccount不会返回sku属性,它只返回计划

如果要获取sku,可以使用以下命令

$sku = (Get-AzResource -ResourceGroupName "<resource group name>" -ResourceType Microsoft.Automation/automationAccounts -ResourceName "<automation account name>").properties.sku
$sku | ConvertTo-Json

我已经试过第一个命令了。理论上你对这个计划的看法是正确的。每当我尝试获取自动化帐户时,没有一个自动化帐户在输出中填写计划。但是您使用.properties.sku的第二个命令成功了。在那里为我节省了很多体力劳动。很多