(Azure VM) How to get the time duration of a deployment in a resource group

Sang Hoon Kim 21 Reputation points
2020-03-11T04:50:09.457+00:00

Hello,

I am currently using Azure to create virtual machines, and I tried to find a way to get the time duration of creating a VM.
As you can see in the picture below, I found that as I go to the deployments section of a resource group where I create a VM, I can see the duration of the deployment for the VM, which is great.

However, I can only see the time duration in Azure portal, but I want to retrieve it using Azure CLI
because I want to automate this process using a script.

I cannot find any way to do this, so please help me!

4181-screen-shot-2020-03-10-at-114521-pm.png

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

Accepted answer
  1. jakaruna-MSFT 596 Reputation points Microsoft Employee
    2020-03-11T12:06:59.807+00:00

    You can use azure CLI or rest apis to get the duration.

    Sample Azure cli command

    az deployment list --query '[].[ name, properties.duration ]'

    This will list the deployment name and the duration. The duration is a string in a specific format.
    For example,

    • PT1M38.9192782S for 1 minute and 38 seconds.
    • PT16.0054451S for 16 seconds.

    Reference for the rest api is here

    1 person found this answer helpful.
    0 comments No comments

0 additional answers

Sort by: Most helpful