Query Azure Arc + Azure VMs extension statues

Bombbe 1,626 Reputation points
2022-02-28T11:14:21.447+00:00

Hi,
I have Arc +normal VMs that has extensions installed but the status is "Failed"

178447-image.png

178467-image.png

I have policy in place that show compliance status of vms that has not Qualys installed but policy do not know that the status of installation (even though it is in failed status is shows compliant in policy). What would be proper way to query all my vms so I could collect data which vms has extension that has been failed (Powershell, CLI, resource graph, etc)?

Azure Arc
Azure Arc
A Microsoft cloud service that enables deployment of Azure services across hybrid and multicloud environments.
434 questions
0 comments No comments
{count} votes

Accepted answer
  1. Stanislav Zhelyazkov 24,536 Reputation points MVP
    2022-03-02T09:26:02.55+00:00

    Hi,
    It might be best to change the policy to have the following condition as well:

    {  
                    "field": "Microsoft.Compute/virtualMachines/extensions/provisioningState",  
                    "in": [  
                      "Succeeded",  
                      "Provisioning succeeded"  
                    ]  
                  }  
    

    This will make sure that the agent is at least provisioned successfully when reported to the policy. Of course there could be still other problems with the agent but provisioning will not be one of them.
    Please "Accept the answer" if the information helped you. This will help us and others in the community as well.

    0 comments No comments

0 additional answers

Sort by: Most helpful

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.