Create an Azure Automation account and create a new Azure Monitor Log Analytics workspace if it doesn't exist, and then link them together.

{"name": "[parameters('automationaccountname')]", "type": "microsoft.automation/automationaccounts", "apiversion": "2021-04-01", "location": "[parameters('automationregion')]", "properties": {"sku": {"name": "[parameters('automationpricingtier')]"}}, "resources": [{"name": "[variables('automation').runbook.publishomshypervreplica.name]", "type": "runbooks", "apiversion": "2015-10-31", "location": "[parameters('automationregion')]", "dependson": ["[resourceid('microsoft.automation/automationaccounts/", parameters('automationaccountname'))]"], "properties": {"runbooktype": "[variables('automation').runbook.publishomshypervreplica.type]", "logprogress": false, "logverbose": false, "description": "[variables('automation').runbook.publishomshypervreplica.description]", "publishcontentlink": {"uri": "[uri(parameters('_artifactslocation'), concat('scripts/", variables('automation').runbook.publishomshypervreplica.name, ".ps1", parameters('_artifactslocationsastoken')))]", "version": "1.0.0.0"}}}, {"name": "[concat(parameters('automationaccountname'), "/", variables('automation').asset.omshypervreplicarunnumber.name)]", "type": "microsoft.automation/automationaccounts/variables", "apiversion": "2021-04-01", "location": "[parameters('automationregion')]", "dependson": ["[resourceid('microsoft.automation/automationaccounts/", parameters('automationaccountname'))]"], "properties": {"description": "[variables('automation').asset.omshypervreplicarunnumber.description]", "isencrypted": false, "type": "[variables('automation').asset.omshypervreplicarunnumber.type]", "value": "[variables('automation').asset.omshypervreplicarunnumber.value]"}}, {"name": "[concat(parameters('automationaccountname'), "/", variables('automation').asset.omshypervreplicarunasaccount.name)]", "type": "microsoft.automation/automationaccounts/credentials", "apiversion": "2021-04-01", "location": "[parameters('automationregion')]", "dependson": ["[resourceid('microsoft.automation/automationaccounts/", parameters('automationaccountname'))]"], "properties": {"username": "[parameters('onpremisesrunasusername')]", "password": "[parameters('onpremisesrunaspassword')]", "description": "[variables('automation').asset.omshypervreplicarunasaccount.description]"}}, {"name": "[concat(parameters('automationaccountname'), "/", variables('automation').module.omsdatainjection.name)]", "type": "microsoft.automation/automationaccounts/modules", "apiversion": "2021-04-01", "location": "[parameters('automationregion')]", "dependson": ["[resourceid('microsoft.automation/automationaccounts/", parameters('automationaccountname'))]"], "properties": {"contentlink": {"uri": "[uri(parameters('_artifactslocation'), concat('assets/", variables('automation').module.omsdatainjection.name, ".zip", parameters('_artifactslocationsastoken')))]"}}}, {"name": "[concat(parameters('automationaccountname'), "/", variables('automation').connection.omsdatainjection.name)]", "type": "microsoft.automation/automationaccounts/connections", "apiversion": "2021-04-01", "location": "[parameters('automationregion')]", "dependson": ["[resourceid('microsoft.automation/automationaccounts/", parameters('automationaccountname'))]", "[resourceid('microsoft.automation/automationaccounts/modules", parameters('automationaccountname'), variables('automation').module.omsdatainjection.name)]"], "properties": {"name": "[variables('automation').connection.omsdatainjection.name]", "description": "[variables('automation').connection.omsdatainjection.description]", "isglobal": false, "connectiontype": {"name": "[variables('automation').connection.omsdatainjection.type]"}, "fielddefinitionvalues": {"omsworkspaceid": "[parameters('workspaceid')]", "primarykey": "[parameters('workspaceprimarykey')]"}}}]}