title: How to get Model ID of the Latest Version registered in Azure Machine Learning Service Model Registry using az ml cli?
body: <p>Using Azure Machine Learning CLI extension, how do we get the Model ID for the latest version of a Model (with known model name)?</p>
  <p>To get the entire list of Model Details with a given name the command is</p>
  <pre><code>az ml model list --model-name [Model_Name] --resource-group [RGP_NAME] --subscription-id [SUB_ID] --workspace-name [WS_NAME]
  </code></pre>
  <p>Running this will give a list of all the models:</p>
  <pre><code>[
    {
      &quot;createdTime&quot;: &quot;2021-03-19T07:02:03.814172+00:00&quot;,
      &quot;framework&quot;: &quot;Custom&quot;,
      &quot;frameworkVersion&quot;: null,
      &quot;id&quot;: &quot;model:2&quot;
      &quot;name&quot;: &quot;model&quot;,
      &quot;version&quot;: 3
    },
    {
      &quot;createdTime&quot;: &quot;2021-03-19T06:46:34.301054+00:00&quot;,
      &quot;framework&quot;: &quot;Custom&quot;,
      &quot;frameworkVersion&quot;: null,
      &quot;id&quot;: &quot;model:2&quot;,
      &quot;name&quot;: &quot;model&quot;,
      &quot;version&quot;: 2
    },
    {
      &quot;createdTime&quot;: &quot;2021-03-19T06:38:56.558385+00:00&quot;,
      &quot;framework&quot;: &quot;Custom&quot;,
      &quot;frameworkVersion&quot;: null,
      &quot;id&quot;: &quot;model:1&quot;,
      &quot;name&quot;: &quot;model&quot;,
      &quot;version&quot;: 1
    }
  ]
  </code></pre>
  <p>The <a href="https://docs.microsoft.com/en-us/cli/azure/ext/azure-cli-ml/ml/model?view=azure-cli-latest#ext_azure_cli_ml_az_ml_model_list" rel="nofollow noreferrer">Microsoft Documentation</a> mentions, we can use a <code>-l</code> parameter to get the latest version details:</p>
  <pre><code>az ml model list --model-name [Model_Name] --resource-group [RGP_NAME] --subscription-id [SUB_ID] --workspace-name [WS_NAME] -l
  </code></pre>
  <p>However, running this gives the following error:</p>
  <pre><code>ERROR: UnrecognizedArgumentError: unrecognized arguments: -l
  </code></pre>
  <p>What is the syntax to use this <code>-l</code> flag?</p>