An optimized solution for installing Wiz Runtime Sensor in all Virtual machines across our organizations Subscriptions.

Prasanna Meenakshi 0 Reputation points
2024-07-18T10:17:57.9633333+00:00

Hi Team,

I am currently working on an objective to install the 'Wiz Runtime Sensor' across all Virtual Machines in our organization's Azure subscriptions. I have compiled a list of active VMs that are potential candidates for this installation. As I am relatively new to Azure, I would greatly appreciate your expert suggestions and guidance on this task. Below is the command I plan to use for installing the component:sudo WIZ_API_CLIENT_ID=

Azure Virtual Machines
Azure Virtual Machines
An Azure service that is used to provision Windows and Linux virtual machines.
8,000 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. deherman-MSFT 37,416 Reputation points Microsoft Employee
    2024-07-19T16:18:04.3266667+00:00

    @Prasanna Meenakshi

    It sounds like you are wanting to run the command sudo WIZ_API_CLIENT_ID= across a list of Azure Linux VMs. Please let me know if I am understanding this correctly.

    One method would be to utilize Run Command for Azure to execute the command across a list of VMs. Assuming you have a file with the VM names you could use this script to fetch the Resource Group and run the command.

    #!/bin/bash
    
    # Path to the file containing VM names
    vm_file="vm_names.txt"
    
    # Command to execute on each VM
    command_to_run="your-command-here"
    
    # Loop through each VM name in the file
    while IFS= read -r vm_name; do
        # Get the resource group of the VM
        resource_group=$(az vm show --name "$vm_name" --query "resourceGroup" -o tsv)
        
        # Execute the command on the VM
        az vm run-command invoke --resource-group "$resource_group" --name "$vm_name" --command-id RunShellScript --scripts "$command_to_run"
    done < "$vm_file"
    
    

    Hope this helps! Please let me know if you have any questions.


    If you still have questions, please let us know in the "comments" and we would be happy to help you. Comment is the fastest way of notifying the experts.

    If the answer has been helpful, we appreciate hearing from you and would love to help others who may have the same question. Accepting answers helps increase visibility of this question for other members of the Microsoft Q&A community.

    Thank you for helping to improve Microsoft Q&A! User's image

    0 comments No comments

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.