Search code examples
azureazure-active-directoryazure-machine-learning-serviceazure-service-principal

az ml workspace share command (v1) alternatives


I'm trying to share my azure ML workspace by SP (Service Principal)

I've created a SP and share my workspace to the SP

But when I try to share a workspace using the cli, I get this error:

'share' is misspelled or not recognized by the system.

Maybe I guess this error was caused by version of azure cli, (share command only exists in v1 docs: https://learn.microsoft.com/en-us/cli/azure/ml(v1)/workspace?view=azure-cli-latest)

I also searched azure-cli v2 documentation and commands (az ml workspace), but I don't have any idea to alter the command above.

Thanks!


Solution

  • It seems you are working on V2 and you want to do workspace sharing, but there are some changes between CLI V1 and V2.

    To migrate from Azure Machine Learning V1 to V2, you need to upgrade az ml workspace share commands to equivalent az role assignment create commands.

    Please refer to here - https://learn.microsoft.com/en-us/cli/azure/role/assignment?view=azure-cli-latest#az-role-assignment-create Create a new role assignment for a user, group, or service principal.

    az role assignment create --role
                              [--assignee]
                              [--assignee-object-id]
                              [--assignee-principal-type {ForeignGroup, Group, ServicePrincipal, User}]
                              [--condition]
                              [--condition-version]
                              [--description]
                              [--name]
                              [--resource-group]
                              [--scope]
    

    There are some examples for how to use it here for your reference - https://learn.microsoft.com/en-us/cli/azure/role/assignment?view=azure-cli-latest#az-role-assignment-create-examples

    I hope this helps!