最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

azure - Deploy ARM template for a runbook for an existing Automation Account - Stack Overflow

programmeradmin3浏览0评论

I'm trying to deploy a simple runbook into existing Automation Account, but it fails saying that this Account is not found

Here is my template:

{
    "$schema": ".json#",
    "contentVersion": "1.0.0.0",
    "parameters": {
        "automationAccountName": {
            "defaultValue": "AccName",
            "type": "String"
        }
    },
    "variables": {},
    "resources": [
        {
            "type": "Microsoft.Automation/automationAccounts/runbooks",
            "apiVersion": "2023-11-01",
            "name": "[concat(parameters('automationAccountName'), '/test1')]",
            "location": "germanywestcentral",
            "properties": {
                "logVerbose": false,
                "logProgress": false,
                "logActivityTrace": 0,
                "runbookType": "PowerShell72"
            }
        }
    ]
}

And the exact error is

{
    "status": "Failed",
    "error": {
        "code": "NotFound",
        "message": "{\"Message\":\"Could not find the account. SubscriptionId: ...redacted... AccountName: AccName\"}"
    }
}

Any ideas what I'm doing wrong?!

I'm trying to deploy a simple runbook into existing Automation Account, but it fails saying that this Account is not found

Here is my template:

{
    "$schema": "https://schema.management.azure/schemas/2019-04-01/deploymentTemplate.json#",
    "contentVersion": "1.0.0.0",
    "parameters": {
        "automationAccountName": {
            "defaultValue": "AccName",
            "type": "String"
        }
    },
    "variables": {},
    "resources": [
        {
            "type": "Microsoft.Automation/automationAccounts/runbooks",
            "apiVersion": "2023-11-01",
            "name": "[concat(parameters('automationAccountName'), '/test1')]",
            "location": "germanywestcentral",
            "properties": {
                "logVerbose": false,
                "logProgress": false,
                "logActivityTrace": 0,
                "runbookType": "PowerShell72"
            }
        }
    ]
}

And the exact error is

{
    "status": "Failed",
    "error": {
        "code": "NotFound",
        "message": "{\"Message\":\"Could not find the account. SubscriptionId: ...redacted... AccountName: AccName\"}"
    }
}

Any ideas what I'm doing wrong?!
Share Improve this question asked Feb 18 at 0:39 Philipp GrigoryevPhilipp Grigoryev 2,1433 gold badges18 silver badges24 bronze badges 2
  • Can you confirm that the automation account you're using was readily available in the subscription and under the same resource group? @PhilippGrigoryev – Vinay B Commented Feb 18 at 3:34
  • Is bicep works with you? @Philipp Grigoryev – Jahnavi Commented Feb 18 at 4:48
Add a comment  | 

1 Answer 1

Reset to default 0

"message": "{"Message":"Could not find the account. Subscription Id:

Usually, if the resource is deployed in different templates or if it has already existed in Azure resources then it should work directly by providing the existing resource name as you did.

Refer MS Doc for more detailed information on the relevant error.

Modify the name field as shown below:

"name": "[concat(parameters('automationAccountName'), '/', parameters('runbook'))]"

Also, make sure that you are setting up the subscription ID in Az CLI before deploying it with az deployment group command to avoid the subscription related conflicts.

Also, make sure that the location of runbook to be deployed is same as the existed automation account.

az account set --subscription "subscriptionID"

ARM JSON configuration:

{
    "$schema": "https://schema.management.azure/schemas/2019-04-01/deploymentTemplate.json#",
    "contentVersion": "1.0.0.0",
    "parameters": {
        "automationAccountName": {
            "defaultValue": "latestacc",
            "type": "String"
        },
        "runbook": {
        "defaultValue": "test1",
        "type": "String"
        }
    },
    "variables": {},
    "resources": [
        {
            "type": "Microsoft.Automation/automationAccounts/runbooks",
            "apiVersion": "2023-11-01",
            "name": "[concat(parameters('automationAccountName'), '/', parameters('runbook'))]",
            "location": "West Europe",
            "properties": {
                "logVerbose": false,
                "logProgress": false,
                "logActivityTrace": 0,
                "runbookType": "PowerShell72"
            }
        }
    ]
}

Output:

发布评论

评论列表(0)

  1. 暂无评论