我在Azure自动化中添加了几个Runbook。现在,当我查看我的azure资源组自动化脚本时,我发现它包含了所有已完成的作业以及许多其他内容。我觉得这里有些不对劲。为什么所有完成的工作都是自动化脚本的一部分?请查看下面的脚本。
{
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"automationAccounts_Test2_Automation_sku": {
"defaultValue": null,
"type": "SecureObject"
},
"automationAccounts_Test2_Automation_name": {
"defaultValue": "test3-Automation",
"type": "String"
},
"storageAccounts_ordersbloblogsdut_name": {
"defaultValue": "ordersbloblogsdut",
"type": "String"
},
"runbooks_PurgeLogs_name": {
"defaultValue": "test3-Automation/PurgeLogs",
"type": "String"
},
"runbooks_deleteItems_name": {
"defaultValue": "test3-Automation/deleteItems",
"type": "String"
},
"modules_Azure_name": {
"defaultValue": "test3-Automation/Azure",
"type": "String"
},
"modules_Azure.Storage_name": {
"defaultValue": "test3-Automation/Azure.Storage",
"type": "String"
},
"modules_AzureRM.Automation_name": {
"defaultValue": "test3-Automation/AzureRM.Automation",
"type": "String"
},
"modules_AzureRM.Compute_name": {
"defaultValue": "test3-Automation/AzureRM.Compute",
"type": "String"
},
"modules_AzureRM.Profile_name": {
"defaultValue": "test3-Automation/AzureRM.Profile",
"type": "String"
},
"modules_AzureRM.Resources_name": {
"defaultValue": "test3-Automation/AzureRM.Resources",
"type": "String"
},
"modules_AzureRM.Sql_name": {
"defaultValue": "test3-Automation/AzureRM.Sql",
"type": "String"
},
"modules_AzureRM.Storage_name": {
"defaultValue": "test3-Automation/AzureRM.Storage",
"type": "String"
},
"modules_Microsoft.PowerShell.Core_name": {
"defaultValue": "test3-Automation/Microsoft.PowerShell.Core",
"type": "String"
},
"modules_Microsoft.PowerShell.Diagnostics_name": {
"defaultValue": "test3-Automation/Microsoft.PowerShell.Diagnostics",
"type": "String"
},
"modules_Microsoft.PowerShell.Management_name": {
"defaultValue": "test3-Automation/Microsoft.PowerShell.Management",
"type": "String"
},
"modules_Microsoft.PowerShell.Security_name": {
"defaultValue": "test3-Automation/Microsoft.PowerShell.Security",
"type": "String"
},
"modules_Microsoft.PowerShell.Utility_name": {
"defaultValue": "test3-Automation/Microsoft.PowerShell.Utility",
"type": "String"
},
"modules_Microsoft.WSMan.Management_name": {
"defaultValue": "test3-Automation/Microsoft.WSMan.Management",
"type": "String"
},
"modules_Orchestrator.AssetManagement.Cmdlets_name": {
"defaultValue": "test3-Automation/Orchestrator.AssetManagement.Cmdlets",
"type": "String"
},
"schedules_PurgeLogsSchedule_name": {
"defaultValue": "test3-Automation/PurgeLogsSchedule",
"type": "String"
},
"schedules_deleteItemsSchedule_name": {
"defaultValue": "test3-Automation/deleteItemsSchedule",
"type": "String"
},
"jobs_dddefbc6_ce31_4baf_8289_091694ff6605_name": {
"defaultValue": "test3-Automation/dddefbc6-ce31-4baf-8289-091694ff6605",
"type": "String"
},
"jobs_d6d7ae51_1fb2_46f1_86c8_251279e093df_name": {
"defaultValue": "test3-Automation/d6d7ae51-1fb2-46f1-86c8-251279e093df",
"type": "String"
},
"jobs_1d2d3f92_5524_4a91_9c47_8e236bc8d46d_name": {
"defaultValue": "test3-Automation/1d2d3f92-5524-4a91-9c47-8e236bc8d46d",
"type": "String"
},
"jobs_8bf70d4a_3143_4d6e_91ef_14f0d33c9235_name": {
"defaultValue": "test3-Automation/8bf70d4a-3143-4d6e-91ef-14f0d33c9235",
"type": "String"
},
"jobs_589caa59_46d5_44d7_8b9d_d754364f09fa_name": {
"defaultValue": "test3-Automation/589caa59-46d5-44d7-8b9d-d754364f09fa",
"type": "String"
},
"jobs_fa6d44b2_3c23_41a2_b14d_81a3f3b1e279_name": {
"defaultValue": "test3-Automation/fa6d44b2-3c23-41a2-b14d-81a3f3b1e279",
"type": "String"
},
"jobs_a7be24d1_588e_4203_a7ae_40c7799e8a63_name": {
"defaultValue": "test3-Automation/a7be24d1-588e-4203-a7ae-40c7799e8a63",
"type": "String"
},
"jobs_75fdb298_12d6_47d9_9ef9_769103641370_name": {
"defaultValue": "test3-Automation/75fdb298-12d6-47d9-9ef9-769103641370",
"type": "String"
},
"jobs_21459a62_bda8_48a1_ac77_fc77edb7277c_name": {
"defaultValue": "test3-Automation/21459a62-bda8-48a1-ac77-fc77edb7277c",
"type": "String"
},
"jobs_68389ebd_d78c_4540_b1e3_fc918c3d7a6f_name": {
"defaultValue": "test3-Automation/68389ebd-d78c-4540-b1e3-fc918c3d7a6f",
"type": "String"
},
"jobs_c9eda4f3_b727_4e1c_8232_276fc1738cac_name": {
"defaultValue": "test3-Automation/c9eda4f3-b727-4e1c-8232-276fc1738cac",
"type": "String"
},
"jobs_84805e33_6b65_4527_872f_94c01d4bd52f_name": {
"defaultValue": "test3-Automation/84805e33-6b65-4527-872f-94c01d4bd52f",
"type": "String"
},
"jobs_b8f9e3a7_b8c9_4ace_b005_cb7a8a8042f4_name": {
"defaultValue": "test3-Automation/b8f9e3a7-b8c9-4ace-b005-cb7a8a8042f4",
"type": "String"
},
"jobs_b415353f_da2a_40b3_88b0_5b99bf00db69_name": {
"defaultValue": "test3-Automation/b415353f-da2a-40b3-88b0-5b99bf00db69",
"type": "String"
},
"jobs_660b1e97_5451_471e_ad6e_f9e2b3fbdf31_name": {
"defaultValue": "test3-Automation/660b1e97-5451-471e-ad6e-f9e2b3fbdf31",
"type": "String"
},
"jobs_9c3f026b_e7d1_45b0_95b4_6884ea560b9d_name": {
"defaultValue": "test3-Automation/9c3f026b-e7d1-45b0-95b4-6884ea560b9d",
"type": "String"
},
"jobs_8d650ae4_8f7d_407f_b9c9_31e6bb902d3d_name": {
"defaultValue": "test3-Automation/8d650ae4-8f7d-407f-b9c9-31e6bb902d3d",
"type": "String"
},
"jobs_f37e4e76_3fff_488c_9d5c_5b6539d626e0_name": {
"defaultValue": "test3-Automation/f37e4e76-3fff-488c-9d5c-5b6539d626e0",
"type": "String"
},
"jobs_2e18b738_b549_45cc_ac2f_90708feeff1d_name": {
"defaultValue": "test3-Automation/2e18b738-b549-45cc-ac2f-90708feeff1d",
"type": "String"
},
"jobs_a754695e_3cd2_4aec_878f_8cd9a5728b95_name": {
"defaultValue": "test3-Automation/a754695e-3cd2-4aec-878f-8cd9a5728b95",
"type": "String"
},
"jobs_b92a4ff4_c4ca_472c_9031_e4b456f77f30_name": {
"defaultValue": "test3-Automation/b92a4ff4-c4ca-472c-9031-e4b456f77f30",
"type": "String"
},
"jobs_91a2d834_8c37_461d_acce_473594bd3f5d_name": {
"defaultValue": "test3-Automation/91a2d834-8c37-461d-acce-473594bd3f5d",
"type": "String"
},
"jobs_72014de4_d6fb_4d57_b9b9_5c8fd9cde973_name": {
"defaultValue": "test3-Automation/72014de4-d6fb-4d57-b9b9-5c8fd9cde973",
"type": "String"
},
"jobs_3de2322a_f04d_452c_aed6_7650e0d3eaa2_name": {
"defaultValue": "test3-Automation/3de2322a-f04d-452c-aed6-7650e0d3eaa2",
"type": "String"
},
"jobs_23e0e810_98fc_4e78_af4c_cdc0da2b8d77_name": {
"defaultValue": "test3-Automation/23e0e810-98fc-4e78-af4c-cdc0da2b8d77",
"type": "String"
},
"jobs_d2428518_fd4c_41d6_88f4_27402401b4dd_name": {
"defaultValue": "test3-Automation/d2428518-fd4c-41d6-88f4-27402401b4dd",
"type": "String"
},
"jobs_1d61307a_2e25_4064_87f5_e83e37d6ff26_name": {
"defaultValue": "test3-Automation/1d61307a-2e25-4064-87f5-e83e37d6ff26",
"type": "String"
},
"jobs_cc668047_7090_4946_a81a_63270eadaf98_name": {
"defaultValue": "test3-Automation/cc668047-7090-4946-a81a-63270eadaf98",
"type": "String"
},
"jobs_a11ecdbf_5b10_4fa6_add5_8541838f0ded_name": {
"defaultValue": "test3-Automation/a11ecdbf-5b10-4fa6-add5-8541838f0ded",
"type": "String"
},
"jobs_825455ac_8f5e_4611_8a30_11607b566a69_name": {
"defaultValue": "test3-Automation/825455ac-8f5e-4611-8a30-11607b566a69",
"type": "String"
},
"jobSchedules_77c19c90_ed86_4a1c_96d3_c41746833890_name": {
"defaultValue": "test3-Automation/77c19c90-ed86-4a1c-96d3-c41746833890",
"type": "String"
},
"jobSchedules_30987e26_6340_4ba2_9f75_42944881c9d6_name": {
"defaultValue": "test3-Automation/30987e26-6340-4ba2-9f75-42944881c9d6",
"type": "String"
}
},
"variables": {},
"resources": [
{
"comments": "Generalized from resource: '/subscriptions/65b7453f-0c39-4f3f-a113-c0f107f431c4/resourcegroups/Test-Data/providers/Microsoft.Automation/automationAccounts/test3-Automation'.",
"type": "Microsoft.Automation/automationAccounts",
"name": "[parameters('automationAccounts_Test2_Automation_name')]",
"apiVersion": "2015-10-31",
"location": "southcentralus",
"properties": {
"sku": "[parameters('automationAccounts_Test2_Automation_sku')]"
},
"resources": [],
"dependsOn": []
},
{
"comments": "Generalized from resource: '/subscriptions/65b7453f-0c39-4f3f-a113-c0f107f431c4/resourceGroups/Test-data/providers/Microsoft.Storage/storageAccounts/ordersbloblogsdut'.",
"type": "Microsoft.Storage/storageAccounts",
"sku": {
"name": "Standard_LRS",
"tier": "Standard"
},
"kind": "BlobStorage",
"name": "[parameters('storageAccounts_ordersbloblogsdut_name')]",
"apiVersion": "2016-01-01",
"location": "westus",
"tags": {},
"properties": {
"accessTier": "Cool"
},
"resources": [],
"dependsOn": []
},
{
"comments": "Generalized from resource: '/subscriptions/65b7453f-0c39-4f3f-a113-c0f107f431c4/resourcegroups/Test-Data/providers/Microsoft.Automation/automationAccounts/test3-Automation/runbooks/PurgeLogs'.",
"type": "Microsoft.Automation/automationAccounts/runbooks",
"name": "[parameters('runbooks_PurgeLogs_name')]",
"apiVersion": "2015-10-31",
"location": "southcentralus",
"properties": {
"runbookType": "Script",
"logVerbose": false,
"logProgress": false
},
"resources": [],
"dependsOn": [
"[resourceId('Microsoft.Automation/automationAccounts', parameters('automationAccounts_Test2_Automation_name'))]"
]
},
{
"comments": "Generalized from resource: '/subscriptions/65b7453f-0c39-4f3f-a113-c0f107f431c4/resourcegroups/Test-Data/providers/Microsoft.Automation/automationAccounts/test3-Automation/runbooks/deleteItems'.",
"type": "Microsoft.Automation/automationAccounts/runbooks",
"name": "[parameters('runbooks_deleteItems_name')]",
"apiVersion": "2015-10-31",
"location": "southcentralus",
"properties": {
"runbookType": "Script",
"logVerbose": false,
"logProgress": false
},
"resources": [],
"dependsOn": [
"[resourceId('Microsoft.Automation/automationAccounts', parameters('automationAccounts_Test2_Automation_name'))]"
]
},
{
"comments": "Generalized from resource: '/subscriptions/65b7453f-0c39-4f3f-a113-c0f107f431c4/resourcegroups/Test-Data/providers/Microsoft.Automation/automationAccounts/test3-Automation/modules/Azure'.",
"type": "Microsoft.Automation/automationAccounts/modules",
"name": "[parameters('modules_Azure_name')]",
"apiVersion": "2015-10-31",
"properties": {
"isGlobal": true,
"version": null,
"sizeInBytes": 0
},
"resources": [],
"dependsOn": [
"[resourceId('Microsoft.Automation/automationAccounts', parameters('automationAccounts_Test2_Automation_name'))]"
]
},
{
"comments": "Generalized from resource: '/subscriptions/65b7453f-0c39-4f3f-a113-c0f107f431c4/resourcegroups/Test-Data/providers/Microsoft.Automation/automationAccounts/test3-Automation/modules/Azure.Storage'.",
"type": "Microsoft.Automation/automationAccounts/modules",
"name": "[parameters('modules_Azure.Storage_name')]",
"apiVersion": "2015-10-31",
"properties": {
"isGlobal": true,
"version": null,
"sizeInBytes": 0
},
"resources": [],
"dependsOn": [
"[resourceId('Microsoft.Automation/automationAccounts', parameters('automationAccounts_Test2_Automation_name'))]"
]
},
{
"comments": "Generalized from resource: '/subscriptions/65b7453f-0c39-4f3f-a113-c0f107f431c4/resourcegroups/Test-Data/providers/Microsoft.Automation/automationAccounts/test3-Automation/modules/AzureRM.Automation'.",
"type": "Microsoft.Automation/automationAccounts/modules",
"name": "[parameters('modules_AzureRM.Automation_name')]",
"apiVersion": "2015-10-31",
"properties": {
"isGlobal": true,
"version": null,
"sizeInBytes": 0
},
"resources": [],
"dependsOn": [
"[resourceId('Microsoft.Automation/automationAccounts', parameters('automationAccounts_Test2_Automation_name'))]"
]
},
{
"comments": "Generalized from resource: '/subscriptions/65b7453f-0c39-4f3f-a113-c0f107f431c4/resourcegroups/Test-Data/providers/Microsoft.Automation/automationAccounts/test3-Automation/modules/AzureRM.Compute'.",
"type": "Microsoft.Automation/automationAccounts/modules",
"name": "[parameters('modules_AzureRM.Compute_name')]",
"apiVersion": "2015-10-31",
"properties": {
"isGlobal": true,
"version": null,
"sizeInBytes": 0
},
"resources": [],
"dependsOn": [
"[resourceId('Microsoft.Automation/automationAccounts', parameters('automationAccounts_Test2_Automation_name'))]"
]
},
{
"comments": "Generalized from resource: '/subscriptions/65b7453f-0c39-4f3f-a113-c0f107f431c4/resourcegroups/Test-Data/providers/Microsoft.Automation/automationAccounts/test3-Automation/modules/AzureRM.Profile'.",
"type": "Microsoft.Automation/automationAccounts/modules",
"name": "[parameters('modules_AzureRM.Profile_name')]",
"apiVersion": "2015-10-31",
"properties": {
"isGlobal": true,
"version": null,
"sizeInBytes": 0
},
"resources": [],
"dependsOn": [
"[resourceId('Microsoft.Automation/automationAccounts', parameters('automationAccounts_Test2_Automation_name'))]"
]
},
{
"comments": "Generalized from resource: '/subscriptions/65b7453f-0c39-4f3f-a113-c0f107f431c4/resourcegroups/Test-Data/providers/Microsoft.Automation/automationAccounts/test3-Automation/modules/AzureRM.Resources'.",
"type": "Microsoft.Automation/automationAccounts/modules",
"name": "[parameters('modules_AzureRM.Resources_name')]",
"apiVersion": "2015-10-31",
"properties": {
"isGlobal": true,
"version": null,
"sizeInBytes": 0
},
"resources": [],
"dependsOn": [
"[resourceId('Microsoft.Automation/automationAccounts', parameters('automationAccounts_Test2_Automation_name'))]"
]
},
{
"comments": "Generalized from resource: '/subscriptions/65b7453f-0c39-4f3f-a113-c0f107f431c4/resourcegroups/Test-Data/providers/Microsoft.Automation/automationAccounts/test3-Automation/modules/AzureRM.Sql'.",
"type": "Microsoft.Automation/automationAccounts/modules",
"name": "[parameters('modules_AzureRM.Sql_name')]",
"apiVersion": "2015-10-31",
"properties": {
"isGlobal": true,
"version": null,
"sizeInBytes": 0
},
"resources": [],
"dependsOn": [
"[resourceId('Microsoft.Automation/automationAccounts', parameters('automationAccounts_Test2_Automation_name'))]"
]
},
{
"comments": "Generalized from resource: '/subscriptions/65b7453f-0c39-4f3f-a113-c0f107f431c4/resourcegroups/Test-Data/providers/Microsoft.Automation/automationAccounts/test3-Automation/modules/AzureRM.Storage'.",
"type": "Microsoft.Automation/automationAccounts/modules",
"name": "[parameters('modules_AzureRM.Storage_name')]",
"apiVersion": "2015-10-31",
"properties": {
"isGlobal": true,
"version": null,
"sizeInBytes": 0
},
"resources": [],
"dependsOn": [
"[resourceId('Microsoft.Automation/automationAccounts', parameters('automationAccounts_Test2_Automation_name'))]"
]
},
{
"comments": "Generalized from resource: '/subscriptions/65b7453f-0c39-4f3f-a113-c0f107f431c4/resourcegroups/Test-Data/providers/Microsoft.Automation/automationAccounts/test3-Automation/modules/Microsoft.PowerShell.Core'.",
"type": "Microsoft.Automation/automationAccounts/modules",
"name": "[parameters('modules_Microsoft.PowerShell.Core_name')]",
"apiVersion": "2015-10-31",
"properties": {
"isGlobal": true,
"version": null,
"sizeInBytes": 0
},
"resources": [],
"dependsOn": [
"[resourceId('Microsoft.Automation/automationAccounts', parameters('automationAccounts_Test2_Automation_name'))]"
]
},
{
"comments": "Generalized from resource: '/subscriptions/65b7453f-0c39-4f3f-a113-c0f107f431c4/resourcegroups/Test-Data/providers/Microsoft.Automation/automationAccounts/test3-Automation/modules/Microsoft.PowerShell.Diagnostics'.",
"type": "Microsoft.Automation/automationAccounts/modules",
"name": "[parameters('modules_Microsoft.PowerShell.Diagnostics_name')]",
"apiVersion": "2015-10-31",
"properties": {
"isGlobal": true,
"version": null,
"sizeInBytes": 0
},
"resources": [],
"dependsOn": [
"[resourceId('Microsoft.Automation/automationAccounts', parameters('automationAccounts_Test2_Automation_name'))]"
]
},
{
"comments": "Generalized from resource: '/subscriptions/65b7453f-0c39-4f3f-a113-c0f107f431c4/resourcegroups/Test-Data/providers/Microsoft.Automation/automationAccounts/test3-Automation/modules/Microsoft.PowerShell.Management'.",
"type": "Microsoft.Automation/automationAccounts/modules",
"name": "[parameters('modules_Microsoft.PowerShell.Management_name')]",
"apiVersion": "2015-10-31",
"properties": {
"isGlobal": true,
"version": null,
"sizeInBytes": 0
},
"resources": [],
"dependsOn": [
"[resourceId('Microsoft.Automation/automationAccounts', parameters('automationAccounts_Test2_Automation_name'))]"
]
},
{
"comments": "Generalized from resource: '/subscriptions/65b7453f-0c39-4f3f-a113-c0f107f431c4/resourcegroups/Test-Data/providers/Microsoft.Automation/automationAccounts/test3-Automation/modules/Microsoft.PowerShell.Security'.",
"type": "Microsoft.Automation/automationAccounts/modules",
"name": "[parameters('modules_Microsoft.PowerShell.Security_name')]",
"apiVersion": "2015-10-31",
"properties": {
"isGlobal": true,
"version": null,
"sizeInBytes": 0
},
"resources": [],
"dependsOn": [
"[resourceId('Microsoft.Automation/automationAccounts', parameters('automationAccounts_Test2_Automation_name'))]"
]
},
{
"comments": "Generalized from resource: '/subscriptions/65b7453f-0c39-4f3f-a113-c0f107f431c4/resourcegroups/Test-Data/providers/Microsoft.Automation/automationAccounts/test3-Automation/modules/Microsoft.PowerShell.Utility'.",
"type": "Microsoft.Automation/automationAccounts/modules",
"name": "[parameters('modules_Microsoft.PowerShell.Utility_name')]",
"apiVersion": "2015-10-31",
"properties": {
"isGlobal": true,
"version": null,
"sizeInBytes": 0
},
"resources": [],
"dependsOn": [
"[resourceId('Microsoft.Automation/automationAccounts', parameters('automationAccounts_Test2_Automation_name'))]"
]
},
{
"comments": "Generalized from resource: '/subscriptions/65b7453f-0c39-4f3f-a113-c0f107f431c4/resourcegroups/Test-Data/providers/Microsoft.Automation/automationAccounts/test3-Automation/modules/Microsoft.WSMan.Management'.",
"type": "Microsoft.Automation/automationAccounts/modules",
"name": "[parameters('modules_Microsoft.WSMan.Management_name')]",
"apiVersion": "2015-10-31",
"properties": {
"isGlobal": true,
"version": null,
"sizeInBytes": 0
},
"resources": [],
"dependsOn": [
"[resourceId('Microsoft.Automation/automationAccounts', parameters('automationAccounts_Test2_Automation_name'))]"
]
},
{
"comments": "Generalized from resource: '/subscriptions/65b7453f-0c39-4f3f-a113-c0f107f431c4/resourcegroups/Test-Data/providers/Microsoft.Automation/automationAccounts/test3-Automation/modules/Orchestrator.AssetManagement.Cmdlets'.",
"type": "Microsoft.Automation/automationAccounts/modules",
"name": "[parameters('modules_Orchestrator.AssetManagement.Cmdlets_name')]",
"apiVersion": "2015-10-31",
"properties": {
"isGlobal": true,
"version": null,
"sizeInBytes": 0
},
"resources": [],
"dependsOn": [
"[resourceId('Microsoft.Automation/automationAccounts', parameters('automationAccounts_Test2_Automation_name'))]"
]
},
{//truncating the rest
答案 0 :(得分:1)
好吧,当我在几个帐户上观察到完全相同的行为时,我相信这完全没问题。但我对此没有任何解释。有趣的是 - 如果你想将Azure自动化迁移到另一个资源组,那么所有这些资源都将迁移(我最近测试过,只是为了好玩)。
底线:这是预期的。
答案 1 :(得分:0)
上面的模板具有为作业声明的参数,但这些参数从不在任何地方使用,模板也没有说实际部署任何作业。假设上面的模板是完整模板,您可以删除这些作业参数或完全忽略它们。
此模板不会执行此操作,但您可能希望ARM模板中的自动化作业的原因是声明这些作业应作为ARM模板部署的一部分运行,无论是一次还是每次部署。由于作业将在模板中,您甚至可以使用资源的{{1}}属性来表示只应在作业完成后部署其他资源。
如果您对作业的名称进行硬编码,则只有在作业所在的自动化帐户中没有具有该名称的作业时,才会将其作为部署的一部分运行。如果您将作业命名为参数并在每个部署中传递一个不同的未使用的作业名称,则该作业将作为每个部署的一部分运行。
自动化作业本质上允许您将可能与Azure无关的必要步骤和任务添加到ARM模板部署中,因为自动化作业只是任意PowerShell代码。