qualys-remediate-unhealthy-vms.ps1 and Automatic remediation script content for vulnerability assessment not working

Muhammad Hassan Syed 16 Reputation points
2020-12-10T18:58:22.347+00:00

We have onboard AWS VMs to azure by azure arc agent, now we need to automate enabling of vulnerability assessment (qulays) on VMs. We tried Azure Resource Manager and PowerShell Script (Update qualys-remediate-unhealthy-vms.ps1) but we are facing below error.

ARM
"New-AzResourceGroupDeployment: 6:46:40 PM - The deployment 'r5' failed with error(s). Showing 1 out of 1 error(s).
Status Message: The resource type could not be found in the namespace 'Microsoft.HybridCompute' for api version '2020-01-01'. (Code:InvalidResourceType)
CorrelationId: 676951bb-dd88-4946-821b-510c6071c2ae"

{
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"virtualMachines": {
"type": "string"
}
},
"resources": [
{
"type": "Microsoft.HybridCompute/virtualMachines/providers/serverVulnerabilityAssessments",
"apiVersion": "2020-01-01",
"name": "aep0natptest06, '/Microsoft.Security/default"

    }
]

}

Script Error

Headers : {[Cache-Control, System.String[]], [Pragma, System.String[]], [x-ms-failure-cause, System.String[]], [x-ms-request-id,
System.String[]]…}
Version : 1.1
StatusCode : 400
Method : GET
Content : {"error":{"code":"NoRegisteredProviderFound","message":"No registered resource provider found for location 'westeurope' and API
version '2015-06-01-preview' for type 'machines'. The supported api-versions are '2019-03-18-preview, 2019-08-02-preview, 2019-12-12,
2020-03-11-preview, 2020-07-30-preview, 2020-08-02, 2020-08-15-preview'. The supported locations are 'westcentralus, westus2,
westeurope, southeastasia, eastus, australiaeast, southcentralus, eastus2, northeurope, uksouth'."}}

Azure Arc
Azure Arc
A Microsoft cloud service that enables deployment of Azure services across hybrid and multicloud environments.
412 questions
Azure Automation
Azure Automation
An Azure service that is used to automate, configure, and install updates across hybrid environments.
1,255 questions
Microsoft Defender for Cloud
Microsoft Defender for Cloud
An Azure service that provides threat protection for workloads running in Azure, on-premises, and in other clouds. Previously known as Azure Security Center and Azure Defender.
1,371 questions
{count} vote

4 answers

Sort by: Most helpful
  1. shashidhar joliholi 266 Reputation points
    2021-02-03T05:35:43.977+00:00

    Hi,
    Where do i find Update qualys-remediate-unhealthy-vms.ps1 script. ?

    Thanks,
    Shashidhar

    1 person found this answer helpful.

  2. Muhammad Hassan Syed 16 Reputation points
    2021-02-04T08:22:54.82+00:00
    1 person found this answer helpful.

  3. olufemia-MSFT 2,861 Reputation points
    2020-12-29T22:27:20.6+00:00

    Hello @Muhammad Hassan Syed , sorry for the delayed response.

    The posted error suggests the Azure Arc Resource provider "Microsoft.HybridCompute" needs to be registered for the desired locations.
    Please confirm the RP is registered and do let us know if issue persists.

    Follow the visual illustration below to confirm.

    52065-azurearcrp.gif


  4. Muhammad Hassan Syed 16 Reputation points
    2021-01-08T05:04:31.853+00:00

    Hi olufemiaMSFT,

    My issue is resolved now. It was not the problem with resource provider. I have now used updated script. Thank you very much. I am much obliged. I will let you know in case of any issue.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.