Integrations/AzureCompute_v2/AzureCompute_v2.py
def list_vms_command():
    """
    List the VM instances in the specified Resource Group

    demisto parameter: (string) resource_group
        Resource Group of the VMs

    returns:
        Virtual Machine Objects
    """
    resource_group = demisto.args().get('resource_group')
    response = list_vms(resource_group)

    vm_objects_list = response.get('value')

    vms = []
    for vm_object in vm_objects_list:
        vm_name = vm_object.get('name').lower()
        location = vm_object.get('location')
        properties = vm_object.get('properties')
        provisioning_state = properties.get('provisioningState')
        os_disk = properties.get('storageProfile', {}).get('osDisk')
        datadisk = os_disk.get('diskSizeGB', 'NA')
        vm_id = properties.get('vmId')
        os_type = os_disk.get('osType')
        vm = {
            'Name': vm_name,
            'ID': vm_id,
            'Size': datadisk,
            'OS': os_type,
            'Location': location,
            'ProvisioningState': provisioning_state,
            'ResourceGroup': resource_group
        }
        vms.append(vm)

    title = 'Microsoft Azure - List of Virtual Machines in Resource Group "{}"'.format(resource_group)
    table_headers = ['Name', 'ID', 'Size', 'OS', 'Location', 'ProvisioningState', 'ResourceGroup']
    human_readable = tableToMarkdown(title, vms, headers=table_headers, removeNull=True)
    entry_context = {'Azure.Compute(val.Name && val.Name === obj.Name)': vms}
    demisto.results({
        'Type': entryTypes['note'],
        'Contents': response,
        'ContentsFormat': formats['text'],
        'ReadableContentsFormat': formats['markdown'],
        'HumanReadable': human_readable,
        'EntryContext': entry_context
    })

    List the VM instances in the specified Resource Group

    demisto parameter: (string) resource_group
        Resource Group of the VMs

    returns:
        Virtual Machine Objects
    
List the VM instances in the specified Resource Group
demisto parameter: (string) resource_group
Resource Group of the VMs

Virtual Machine Objects
List the VM instances in the specified Resource Group demisto parameter : ( string ) resource_group Resource Group of the VMs Virtual Machine Objects
def list_vms_command():
    resource_group = demisto.args().get('resource_group')
    response = list_vms(resource_group)
    vm_objects_list = response.get('value')
    vms = []
    for vm_object in vm_objects_list:
        vm_name = vm_object.get('name').lower()
        location = vm_object.get('location')
        properties = vm_object.get('properties')
        provisioning_state = properties.get('provisioningState')
        os_disk = properties.get('storageProfile', {}).get('osDisk')
        datadisk = os_disk.get('diskSizeGB', 'NA')
        vm_id = properties.get('vmId')
        os_type = os_disk.get('osType')
        vm = {
            'Name': vm_name,
            'ID': vm_id,
            'Size': datadisk,
            'OS': os_type,
            'Location': location,
            'ProvisioningState': provisioning_state,
            'ResourceGroup': resource_group
        }
        vms.append(vm)
    title = 'Microsoft Azure - List of Virtual Machines in Resource Group "{}"'.format(resource_group)
    table_headers = ['Name', 'ID', 'Size', 'OS', 'Location', 'ProvisioningState', 'ResourceGroup']
    human_readable = tableToMarkdown(title, vms, headers=table_headers, removeNull=True)
    entry_context = {'Azure.Compute(val.Name && val.Name === obj.Name)': vms}
    demisto.results({
        'Type': entryTypes['note'],
        'Contents': response,
        'ContentsFormat': formats['text'],
        'ReadableContentsFormat': formats['markdown'],
        'HumanReadable': human_readable,
        'EntryContext': entry_context
    })
def list_vms_command ( ) : resource_group = demisto . args ( ) . get ( 'resource_group' ) response = list_vms ( resource_group ) vm_objects_list = response . get ( 'value' ) vms = [ ] for vm_object in vm_objects_list : vm_name = vm_object . get ( 'name' ) . lower ( ) location = vm_object . get ( 'location' ) properties = vm_object . get ( 'properties' ) provisioning_state = properties . get ( 'provisioningState' ) os_disk = properties . get ( 'storageProfile' , { } ) . get ( 'osDisk' ) datadisk = os_disk . get ( 'diskSizeGB' , 'NA' ) vm_id = properties . get ( 'vmId' ) os_type = os_disk . get ( 'osType' ) vm = { 'Name' : vm_name , 'ID' : vm_id , 'Size' : datadisk , 'OS' : os_type , 'Location' : location , 'ProvisioningState' : provisioning_state , 'ResourceGroup' : resource_group } vms . append ( vm ) title = 'Microsoft Azure - List of Virtual Machines in Resource Group "{}"' . format ( resource_group ) table_headers = [ 'Name' , 'ID' , 'Size' , 'OS' , 'Location' , 'ProvisioningState' , 'ResourceGroup' ] human_readable = tableToMarkdown ( title , vms , headers = table_headers , removeNull = True ) entry_context = { 'Azure.Compute(val.Name && val.Name === obj.Name)' : vms } demisto . results ( { 'Type' : entryTypes [ 'note' ] , 'Contents' : response , 'ContentsFormat' : formats [ 'text' ] , 'ReadableContentsFormat' : formats [ 'markdown' ] , 'HumanReadable' : human_readable , 'EntryContext' : entry_context } )
List the VM instances in the specified Resource Group
demisto parameter: (string) resource_group
Resource Group of the VMs
List the VM instances in the specified Resource Group demisto parameter : ( string ) resource_group Resource Group of the VMs
"""
    List the VM instances in the specified Resource Group

    demisto parameter: (string) resource_group
        Resource Group of the VMs

    returns:
        Virtual Machine Objects
    """