Can I use Azure interactive mode for azure-cli-ml extension? - azure

I'm using Azure CLI interactive mode az interactive to run below command.
az ml folder attach -w yhd-mlws -g yhd-mlws-rg
It prompts me with below error message.
az: error: unrecognized arguments: -w yhd-mlws -g yhd-mlws-rg
BTW, both my Machine Learning workspace yhd-mlws and resource group yhd-mlws-rg had been created in my Azure subscription. Azure CLI extension for machine learning service had also been installed via az extension add -n azure-cli-ml.
Then I run command az ml folder attach without any argument. I get bellow error message.
Message: Error, default workspace not set and workspace name parameter not provided.
Please set a default workspace using "az ml folder attach -w myworkspace -g myresourcegroup" or provide a value for the workspace name parameter.
The command window exit the interactive mode after above error message. Then I try the command az ml folder attach -w yhd-mlws -g yhd-mlws-rg again, bingo! It works.
Here comes my question, does azure-cli-ml extension support Azure CLI interactive mode? You know, Azure CLI interactive mode is amazing and I want to use it whenever possible. Thanks!
BTW, I'm running windows command window in Windows Server 2016 Datcenter. Azure-cli version is 2.0.79.

I can reproduce your issue, the interactive mode should support the azure-cli-ml extension, because when I run az ml workspace list, it works, once I pass the -g parameter, it gives the same error, maybe it is a bug, but I am not sure, the interactive is in preview currently.
If you want to run az ml folder attach -w yhd-mlws -g yhd-mlws-rg in the interactive mode, my workaround is to pass the #, i.e. # az ml folder attach -w yhd-mlws -g yhd-mlws-rg.

Related

Error when install Azure-Cli on my self hosted windows agent

I have Azure DevOps pipelines using my Windows Self-hosted agent on my intranet.
I want pipelines to create universal packages and I read that I must install an extension to Azure-Cli on the agent for this.
After several errors where system team helped me setup proxy and all, I run this command in elevated command prompt:
az extension add --name azure-devops
I have this error message:
Unable to get extension index.
Response body does not contain valid json. Error detail: Expecting value: line 1 column 1 (char 0)
What could be the issue ?
First of all, as Doris said, you need meet the most basic conditions for installing the azure-devops extension, that is, the version of az cli should be higher than 2.0.69. But as far as I know, this should not be the cause of issue you encountered.
azure cli along with extensions are all built with python. So you will find that "Error detail: Expecting value: line 1 column 1 (char 0)" is a normal JSONParseDecode error if you google it. It has many causes, like empty response, non-json response content, 500/503 error and etc. Without internet trace, I'm afraid it's hard to find the exact cause of it.
Work around:
========================================
To work around this issue so that you can use az devops command to achieve your goal, you can follow below steps:
1) Install the corresponding whl file into your local machine.
2) Retrieve the downloaded whl file location, then run this command from your command line(Here I would show you the sample script I used):
az extension add --source C:\Users\merlinl\Downloads\azure_devops-0.18.0-py2.py3-none-any.whl
3) Now you will see that the azure-devops installed successfully.
Check your CLI version.
You must have at least v2.0.69, which you can verify with az --version command. Refer to this.

Azure CLI command on powershell is giving '"c:\\\"Program' is not recognized as an internal or external command,

Az CLI is working on windows cmd prompt but they i am trying to execute the same on powershell or ISE it is giving above message and then execute the command.
I guess you need to install
https://learn.microsoft.com/en-us/powershell/azure/new-azureps-module-az?view=azps-4.5.0&viewFallbackFrom=azps-2.6.0
as i see Azure CLI is already installed.

Is there some tool/command to run azcli files from powershell?

I'm using VS Code, and to get some intellisense when writing the azure cli script I've put everything in a .azcli file. My question now is how do I execute that file from a powershell terminal? Also, is it possible to use parameters in such a script like:
az servicebus topic create -g $resourceGroup -n $topicName --namespace-name $namespace
Is it possible to call a azcli file that looks like the one above and provice the $resourceGroup, $topicName, $namespace as argument from powershell?
I'm not aware of an easy way to do this in PowerShell. If someone knows, I would like to know as well.
If you have Windows Subsystem for Linux installed, you can run .azcli files just like .sh shell scripts inside WSL from PowerShell. WSL will need to have Azure CLI installed as well, so depending on the distribution you pick(Ubuntu or Debian are ussually safe), you will need to follow the instructions from Install the Azure CLI.
To run script in WSL from PowerShell terminal:
bash -c "./file.azcli"
Or directly in WSL terminal:
./file.azcli
You can use parameters in a .azcli file just like .sh shell scripts:
resourceGroup=MyRG
topicName=MyTopicName
namespace=myNameSpaceName
az servicebus topic create -g $resourceGroup -n $topicName --namespace-name $namespace
You could also create a .vscode/tasks.json, similar to what this GitHub issue recommends.

How to fix 'command not found' error in Databricks when creating a secret scope

I am trying to create a secret scope in a Databricks notebook. The notebook is running using a cluster created by my company's admin - I don't have access to create or edit clusters. I'm following the instructions in the Databricks user notebooks (https://docs.databricks.com/user-guide/secrets/example-secret-workflow.html#example-secret-workflow) but get an error:
/bin/bash: databricks: command not found
Below is the code I've tried that returns the error:
%sh -e
databricks secrets create-scope --scope scopename
sh% is used so I can run the command line language in the notebook. I've tried using
%sh
and also
%sh -e
no luck.
I should be able to create a secret scope using this code but have had no luck. Any suggestions on the cause of this? Has anyone else had the same issue?
I've not heard of running the CLI from the cluster before. Even if it is installed I doubt it is configured.
You can download the CLI and run it from your local machine: https://docs.databricks.com/user-guide/dev-tools/databricks-cli.html
You will need to be running Python locally. If you prefer there is also a PowerShell command-line (disclaimer I produced this): https://github.com/DataThirstLtd/azure.databricks.cicd.tools
Databricks clusters don't have databricks-cli installed by default. That doesn't mean you can't install it on the cluster. You can install databricks-cli using the following command in any databricks notebook:
%sh
/databricks/python/bin/pip install databricks-cli==0.9.1
Logging in may be a problem as you can't send responses using shell scripts within the notebooks. You can create the .databrickscfg file in the clusters root directory using the following set of commmands:
%sh
> ~/.databrickscfg
echo "[DEFAULT]" >> ~/.databrickscfg
echo "host = <your host>" >> ~/.databrickscfg
echo "token = <your token>" >> ~/.databrickscfg
You can save these commands as shell scripts that can be run automatically on cluster start up (init scripts).
I faced same issue with notebook.
If you have to run any databricks cli commands on your databricks instance, easiest way should be to use Web terminal.
You can launch web terminal from compute->Clusters->Apps->Launch Web Terminal
If not installed , you can use pip install databricks-cli
Configure user through command databricks configure or databricks
configure --token
Now you are good to run databricks cli commands
Here's a sample run on databricks web terminal which worked for me:
One other reason the ( /bin/bash: databricks: command not found) can happen that I noticed on my mac that is not listed here is the user path not exported. add this to your bash profile file or just run the command : export PATH="......(path to your python library)/Library/Python/3.9/bin"

Cannot install Azure Dev Spaces using cloud shell in AKS

When i run the below command in cloud shell.
az aks use-dev-spaces -g aksrgrp -n akscluster
I get the below error. Any help will be highly appreciated
You may be prompted for your administrator password to authorize the installation process.
/tmp/tmpy1vng2we/azds-linux-setup.sh: line 84: sudo: command not found
/tmp/tmpy1vng2we/azds-linux-setup.sh: line 112: sudo: command not found
[INFO] Failed to install dotnet core dependencies.
[INFO] You can manually install all required dependencies based on the following documentation:
[FATAL] https://www.microsoft.com/net/download/dotnet-core/2.1
Azure Dev Spaces CLI not installed properly. Visit 'https://aka.ms/get-azds' for Azure Dev Spaces.
The error shows why the issue happens. It cannot find the command azds. Because the cloud shell does not install the command tool. You can find all the command tools installed in the cloud shell here.
I suggest you can install the tool which you need in the Azure VM of the azure Kubernetes, if you do not find the tool what you want.
It's a better way for you. By the way, the Cloud Shell just enables access to a browser-based command-line experience built with Azure management tasks in mind. So install the Azure CLI in the VM is a better experience.
To add to Charles's answer: the Azure Dev Spaces CLI currently does not support running in the Cloud Shell. Its functionality is designed more for running on your local dev machine where you application's source code is.

Resources