2

I am trying to register a data set programmatically using azurecli authentication

What I tried

authentication = AzureCliAuthentication()

workspace = Workspace.from_config( "config.json"), auth=authentication)
store = Datastore.get(workspace, datastore_name)
path = [(store, filePath)]
dataset = Dataset.Tabular.from_delimited_files(path=path)

I am logged in using azure-cli

az login

I am currently the owner of the datastore_name which is a gen2 datalake instance in the same subscription / region as the Azure ML workspace

Question

  • I get an interactive login each time I get to the Dataset.Tabular.from_ line. How can make it use the azure cli creds ?

  • I plan to use the same python script as part of CI/CD pipeline azurecli task to register the datasets across multiple workspaces

frictionlesspulley
  • 11,070
  • 14
  • 66
  • 115

2 Answers2

0

You can also use cli_auth

from azureml.core.authentication import AzureCliAuthentication
cli_auth = AzureCliAuthentication()
ws = Workspace(
    subscription_id="your-sub-id",
    resource_group="your-resource-group-id",
    workspace_name="your-workspace-name",
    auth=cli_auth
)
mousetail
  • 7,009
  • 4
  • 25
  • 45
-1

You can use the CLI command directly if you wish to use a script to register in Azure ML using Devops.

az ml dataset register [--file]
                       [--output-metadata-file]
                       [--path]
                       [--resource-group]
                       [--show-template]
                       [--skip-validation]
                       [--subscription-id]
                       [--workspace-name]