Search code examples
azureazure-devopsazure-cli

Getting error while Registering model in Azure Pipeline using Azure cli


I am new to Azure Devops. I have created a CI-CD pipeline for my machine learning model. After my model training is completed , I am trying to register the model using Azure Cli with the below inline command :

az ml model register -g $(azureml.resourceGroup) -w $(azureml.workspaceName) -n $(model.name) -f metadata/run.json --asset-path outputs/models/insurance_model.pkl -d "Classification model for filling a claim prediction" --tag "data"="insurance" --tag "model"="classification" --model-framework ScikitLearn -t metadata/model.json

But I am getting the below error:

/opt/hostedtoolcache/Python/3.6.15/x64/lib/python3.6/site-packages/jwt/utils.py:7: CryptographyDeprecationWarning: Python 3.6 is no longer supported by the Python core team. Therefore, support for it is deprecated in cryptography and will be removed in a future release.
  from cryptography.hazmat.primitives.asymmetric.ec import EllipticCurve
/opt/hostedtoolcache/Python/3.6.15/x64/lib/python3.6/site-packages/azureml/_cli/cli_command.py:11: FutureWarning: azureml.core: AzureML support for Python 3.6 is deprecated and will be dropped in an upcoming release. At that point, existing Python 3.6 workflows that use AzureML will continue to work without modification, but Python 3.6 users will no longer get access to the latest AzureML features and bugfixes. We recommend that you upgrade to Python 3.7 or newer. To disable SDK V1 deprecation warning set the environment variable AZUREML_DEPRECATE_WARNING to 'False'
  from azureml.core import get_run
ERROR: unrecognized arguments: =classification

I am not able to find the issue as I am new to Azure Devops. How to solve this issue?


Solution

  • As the above comment with Try adding this in your multiple tags --tag “data=insurance” --tag “model=classification” ? worked for you, Posting it as an answer:-

    Use the below Azure CLI command from this MS
    Document
    and this Document for azure-cli-ml extension in your CLI task in azure devops:-

    CLI:-

    az extension add -n azure-cli-ml
    az ml model register -g <resourcegroupname -w machine-learning workspace name> -n siliconmodel -f metadata/run.json --asset-path <path>_model.pkl -d "Classification model for filling a claim prediction" --tag "data=insurance" --tag "model=classification" --model-framework ScikitLearn -t metadata/model.json
    
    

    Azure Devops yaml:-

    task: AzureCLI@2
    
    inputs:
    
    azureSubscription: '<subscription>'
    
    scriptType: 'bash'
    
    scriptLocation: 'inlineScript'
    
    inlineScript: |
    
    az extension add -n azure-cli-ml
    
    az ml model register -g resourcegroupname -w mlworkspacename-n siliconmodel -f metadata/run.json --asset-path <path>_model.pkl -d "Classification model for filling a claim prediction" --tag "data=insurance" --tag "model=classification" --model-framework ScikitLearn -t metadata/model.json
    
    

    enter image description here