Open jayaakshayan opened 4 years ago
Hi @jayaakshayan ,
Can you update the extension and check if that resolves the issue?
If not, please run az devops -h --debug
and share the corresponding debug logs.
Az extension is up to date, attached below the Az devops -h --debug
DEBUG: Command arguments: ['devops', '-h', '--debug']
2020-03-12T12:32:22.0100157Z DEBUG: Event: Cli.PreExecute []
2020-03-12T12:32:22.0103668Z DEBUG: Event: CommandParser.OnGlobalArgumentsCreate [<function CLILogging.on_global_arguments at 0x02669540>, <function OutputProducer.on_global_arguments at 0x026B21E0>, <function CLIQuery.on_global_arguments at 0x026C1300>]
2020-03-12T12:32:22.0314031Z DEBUG: Event: CommandInvoker.OnPreCommandTableCreate []
2020-03-12T12:32:22.0395006Z DEBUG: Installed command modules ['acr', 'acs', 'advisor', 'ams', 'apim', 'appconfig', 'appservice', 'backup', 'batch', 'batchai', 'billing', 'botservice', 'cdn', 'cloud', 'cognitiveservices', 'configure', 'consumption', 'container', 'cosmosdb', 'deploymentmanager', 'dla', 'dls', 'dms', 'eventgrid', 'eventhubs', 'extension', 'feedback', 'find', 'hdinsight', 'interactive', 'iot', 'iotcentral', 'keyvault', 'kusto', 'lab', 'managedservices', 'maps', 'monitor', 'natgateway', 'netappfiles', 'network', 'policyinsights', 'privatedns', 'profile', 'rdbms', 'redis', 'relay', 'reservations', 'resource', 'role', 'search', 'security', 'servicebus', 'servicefabric', 'signalr', 'sql', 'sqlvm', 'storage', 'vm']
2020-03-12T12:32:22.0448290Z DEBUG: Loaded module 'acr' in 0.005 seconds.
2020-03-12T12:32:22.0577484Z DEBUG: Loaded module 'acs' in 0.013 seconds.
2020-03-12T12:32:22.0592187Z DEBUG: Loaded module 'advisor' in 0.001 seconds.
2020-03-12T12:32:22.0600931Z DEBUG: Event: CommandLoader.OnLoadCommandTable []
2020-03-12T12:32:22.0641416Z DEBUG: Loaded module 'ams' in 0.005 seconds.
2020-03-12T12:32:22.0659680Z DEBUG: Loaded module 'apim' in 0.002 seconds.
2020-03-12T12:32:22.0686594Z DEBUG: Loaded module 'appconfig' in 0.003 seconds.
2020-03-12T12:32:22.0771634Z DEBUG: Loaded module 'appservice' in 0.008 seconds.
2020-03-12T12:32:22.0806050Z DEBUG: Loaded module 'backup' in 0.003 seconds.
2020-03-12T12:32:22.0832681Z DEBUG: Event: CommandLoader.OnLoadCommandTable []
2020-03-12T12:32:22.0878187Z DEBUG: Loaded module 'batch' in 0.007 seconds.
2020-03-12T12:32:22.0905806Z DEBUG: Loaded module 'batchai' in 0.003 seconds.
2020-03-12T12:32:22.0922642Z DEBUG: Loaded module 'billing' in 0.002 seconds.
2020-03-12T12:32:22.0954940Z DEBUG: Loaded module 'botservice' in 0.003 seconds.
2020-03-12T12:32:22.0962682Z DEBUG: Event: CommandLoader.OnLoadCommandTable []
2020-03-12T12:32:22.0984345Z DEBUG: Loaded module 'cdn' in 0.003 seconds.
2020-03-12T12:32:22.1000150Z DEBUG: Loaded module 'cloud' in 0.001 seconds.
2020-03-12T12:32:22.1017068Z DEBUG: Loaded module 'cognitiveservices' in 0.002 seconds.
2020-03-12T12:32:22.1028457Z DEBUG: Loaded module 'configure' in 0.001 seconds.
2020-03-12T12:32:22.1058543Z DEBUG: Loaded module 'consumption' in 0.003 seconds.
2020-03-12T12:32:22.1077143Z DEBUG: Loaded module 'container' in 0.002 seconds.
2020-03-12T12:32:22.1134649Z DEBUG: Loaded module 'cosmosdb' in 0.006 seconds.
2020-03-12T12:32:22.1158247Z DEBUG: Loaded module 'deploymentmanager' in 0.002 seconds.
2020-03-12T12:32:22.1197394Z DEBUG: Loaded module 'dla' in 0.004 seconds.
2020-03-12T12:32:22.1228984Z DEBUG: Loaded module 'dls' in 0.003 seconds.
2020-03-12T12:32:22.1248682Z DEBUG: Loaded module 'dms' in 0.002 seconds.
2020-03-12T12:32:22.1271975Z DEBUG: Loaded module 'eventgrid' in 0.002 seconds.
2020-03-12T12:32:22.1303990Z DEBUG: Loaded module 'eventhubs' in 0.003 seconds.
2020-03-12T12:32:22.1313809Z DEBUG: Loaded module 'extension' in 0.001 seconds.
2020-03-12T12:32:22.1322433Z DEBUG: Loaded module 'feedback' in 0.001 seconds.
2020-03-12T12:32:22.1331759Z DEBUG: Loaded module 'find' in 0.001 seconds.
2020-03-12T12:32:22.1359244Z DEBUG: Loaded module 'hdinsight' in 0.003 seconds.
2020-03-12T12:32:22.1363328Z DEBUG: Loaded module 'interactive' in 0.000 seconds.
2020-03-12T12:32:22.1403515Z DEBUG: Loaded module 'iot' in 0.004 seconds.
2020-03-12T12:32:22.1416998Z DEBUG: Loaded module 'iotcentral' in 0.001 seconds.
2020-03-12T12:32:22.1469360Z DEBUG: Loaded module 'keyvault' in 0.005 seconds.
2020-03-12T12:32:22.1489091Z DEBUG: Loaded module 'kusto' in 0.002 seconds.
2020-03-12T12:32:22.1523221Z DEBUG: Loaded module 'lab' in 0.003 seconds.
2020-03-12T12:32:22.1538572Z DEBUG: Loaded module 'managedservices' in 0.002 seconds.
2020-03-12T12:32:22.1553510Z DEBUG: Loaded module 'maps' in 0.001 seconds.
2020-03-12T12:32:22.1609972Z DEBUG: Loaded module 'monitor' in 0.006 seconds.
2020-03-12T12:32:22.1625314Z DEBUG: Loaded module 'natgateway' in 0.001 seconds.
2020-03-12T12:32:22.1634110Z DEBUG: Event: CommandLoader.OnLoadCommandTable []
2020-03-12T12:32:22.1657299Z DEBUG: Loaded module 'netappfiles' in 0.003 seconds.
2020-03-12T12:32:22.1914477Z DEBUG: Loaded module 'network' in 0.026 seconds.
2020-03-12T12:32:22.1933808Z DEBUG: Loaded module 'policyinsights' in 0.002 seconds.
2020-03-12T12:32:22.1973276Z DEBUG: Loaded module 'privatedns' in 0.004 seconds.
2020-03-12T12:32:22.1989269Z DEBUG: Loaded module 'profile' in 0.002 seconds.
2020-03-12T12:32:22.2044858Z DEBUG: Loaded module 'rdbms' in 0.005 seconds.
2020-03-12T12:32:22.2065080Z DEBUG: Loaded module 'redis' in 0.002 seconds.
2020-03-12T12:32:22.2094434Z DEBUG: Loaded module 'relay' in 0.003 seconds.
2020-03-12T12:32:22.2114622Z DEBUG: Loaded module 'reservations' in 0.002 seconds.
2020-03-12T12:32:22.2176054Z DEBUG: Loaded module 'resource' in 0.006 seconds.
2020-03-12T12:32:22.2214852Z DEBUG: Loaded module 'role' in 0.004 seconds.
2020-03-12T12:32:22.2231053Z DEBUG: Loaded module 'search' in 0.001 seconds.
2020-03-12T12:32:22.2254680Z DEBUG: Loaded module 'security' in 0.002 seconds.
2020-03-12T12:32:22.2304115Z DEBUG: Loaded module 'servicebus' in 0.005 seconds.
2020-03-12T12:32:22.2329234Z DEBUG: Loaded module 'servicefabric' in 0.002 seconds.
2020-03-12T12:32:22.2344673Z DEBUG: Loaded module 'signalr' in 0.001 seconds.
2020-03-12T12:32:22.2409568Z DEBUG: Loaded module 'sql' in 0.006 seconds.
2020-03-12T12:32:22.2426577Z DEBUG: Loaded module 'sqlvm' in 0.002 seconds.
2020-03-12T12:32:22.2436107Z DEBUG: Event: CommandLoader.OnLoadCommandTable []
2020-03-12T12:32:22.2671236Z DEBUG: Loaded module 'storage' in 0.025 seconds.
2020-03-12T12:32:22.2808216Z DEBUG: Loaded module 'vm' in 0.014 seconds.
2020-03-12T12:32:22.2811328Z DEBUG: Loaded all modules in 0.236 seconds. (note: there's always an overhead with the first module loaded)
2020-03-12T12:32:22.2829081Z DEBUG: Extensions directory: 'C:\Program Files\Common Files\AzureCliExtensionDirectory'
2020-03-12T12:32:22.2840593Z DEBUG: Found 1 extensions: ['azure-devops']
2020-03-12T12:32:22.2844681Z DEBUG: Extensions directory: 'C:\Program Files\Common Files\AzureCliExtensionDirectory'
2020-03-12T12:32:22.2855774Z DEBUG: Extension compatibility result: is_compatible=True cli_core_version=2.1.0 min_required=None max_required=None
2020-03-12T12:32:22.2866130Z DEBUG: Module 'azext_devops' is missing COMMAND_LOADER_CLS
entry.
2020-03-12T12:32:22.2866626Z DEBUG: Event: MainLoader.OnFailedExtensionLoad []
2020-03-12T12:32:22.2867216Z WARNING: Unable to load extension 'azure-devops'. Use --debug for more information.
2020-03-12T12:32:22.2870092Z DEBUG: Traceback (most recent call last):
2020-03-12T12:32:22.2870971Z File "C:\Users\VSSADM~1\AppData\Local\Temp\pip-install-3pnsb50r\azure-cli-core\azure\cli\core__init__.py", line 210, in _update_command_table_from_extensions
2020-03-12T12:32:22.2871997Z File "C:\Users\VSSADM~1\AppData\Local\Temp\pip-install-3pnsb50r\azure-cli-core\azure\cli\core\commands__init.py", line 969, in _load_extension_command_loader
2020-03-12T12:32:22.2873087Z File "C:\Users\VSSADM~1\AppData\Local\Temp\pip-install-3pnsb50r\azure-cli-core\azure\cli\core\commands\init__.py", line 965, in _load_command_loader
2020-03-12T12:32:22.2873825Z UnboundLocalError: local variable 'command_loader' referenced before assignment
2020-03-12T12:32:22.2874282Z
2020-03-12T12:32:22.2874741Z DEBUG: Event: CommandInvoker.OnPreCommandTableTruncate [<function AzCliLogging.init_command_file_logging at 0x027FC4F8>]
2020-03-12T12:32:22.2883320Z INFO: az_command_data_logger : command args: devops -h --debug
2020-03-12T12:32:22.2884632Z DEBUG: metadata file logging enabled - writing logs to 'E:\VSTSAgents\zpppdvbavm07-0003_temp.azclitask\commands'.
2020-03-12T12:32:22.2916401Z DEBUG: Event: CommandInvoker.OnPreArgumentLoad [<function register_global_subscription_argument.
Hi @jayaakshayan can you specify which agent pool you used when you encountered this error?
We use self-hosted agent pool.
@jayaakshayan How are you installing the az devops
extension in that agent since you mentioned it works locally?
i installed like az extension add —name azure-devops.
The installation will be happen through pipeline with invoke command to VM agent.
Fyi, created self-hosted agent with the https://github.com/microsoft/azure-pipelines-image-generation?files=1
Hi @jayaakshayan, right now that extension is not supported in the self hosted agents when you use the AzCLIv2 task. For now, as a work-around, you can add az extension add -n azure-devops
in your script and that'll let you use the extension in your task
It doesn’t solve the problem. When i do the workaround it says “ warning: Extension ‘azure-devops’ is already installed.
Warning: unable to load extension ‘azure-devops’.
Can you run the command with --debug and share the logs? Please make sure you are doing this inside the script. I want to check the extensions path from the logs
Is there any update on this problem? I have hit exactly the same issue, I am using a self-hosted agent on a stock Azure Ubuntu VM and I am trying to use storage-preview extension instead. Behavior is identical to the one described above: extension is installed, it works if I use it from the agent in an interactive mode, but it does not work if invoked from a pipeline.
facing same issue with azure windows VM self hosted agent .
Unable to prompt for extension install confirmation as no tty available. Run 'az config set extension.use_dynamic_install=yes_without_prompt' to allow installing extensions without prompt.
Any workarounds ?
I am also facing same issue on self-hosted linux agent:
ERROR: The command requires the extension azure-devops. Unable to prompt for extension install confirmation as no tty available. Run 'az config set extension.use_dynamic_install=yes_without_prompt' to allow installing extensions without prompt.
Experiencing the same issue on a selfhosted Windows machine agent.
Script:
az devops login --organization https://dev.azure.com/OrganizationName
$sourceDirectory = "$(Build.SourcesDirectory)"
$version = (Get-Item "$sourceDirectory\Program.exe").VersionInfo.FileVersion
$buildId = "$(Build.BuildID)"
az pipelines runs tag add --run-id "$buildId" --tags "$version" --detect true
Logs:
Starting: Tag build with server version
==============================================================================
Task : Azure CLI
Description : Run Azure CLI commands against an Azure subscription in a PowerShell Core/Shell script when running on Linux agent or PowerShell/PowerShell Core/Batch script when running on Windows agent.
Version : 2.1.0
Author : Microsoft Corporation
Help : https://docs.microsoft.com/azure/devops/pipelines/tasks/deploy/azure-cli
==============================================================================
C:\WINDOWS\system32\cmd.exe /D /S /C ""C:\Program Files (x86)\Microsoft SDKs\Azure\CLI2\wbin\az.cmd" --version"
azure-cli 2.20.0
Please let us know how we are doing: https://aka.ms/azureclihats
core 2.20.0
and let us know if you're interested in trying out our newest features: https://aka.ms/CLIUXstudy
telemetry
Extensions:
azure-devops 0.18.0
Python location 'C:\Program Files (x86)\Microsoft SDKs\Azure\CLI2\python.exe'
Extensions directory 'C:\Users\username\.azure\cliextensions'
Python (Windows) 3.6.8 (tags/v3.6.8:3c6b436a57, Dec 23 2018, 23:31:17) [MSC v.1916 32 bit (Intel)]
Legal docs and information: aka.ms/AzureCliLegal
Your CLI is up-to-date.
Setting AZURE_CONFIG_DIR env variable to: C:\agentname\_work\_temp\.azclitask
Setting active cloud to: AzureCloud
C:\WINDOWS\system32\cmd.exe /D /S /C ""C:\Program Files (x86)\Microsoft SDKs\Azure\CLI2\wbin\az.cmd" cloud set -n AzureCloud"
C:\WINDOWS\system32\cmd.exe /D /S /C ""C:\Program Files (x86)\Microsoft SDKs\Azure\CLI2\wbin\az.cmd" login --service-principal -u *** "--password=***" --tenant *** --allow-no-subscriptions"
[
{
"cloudName": "AzureCloud",
"homeTenantId": "***",
"id": "***",
"isDefault": true,
"managedByTenants": [],
"name": "***",
"state": "Enabled",
"tenantId": "***",
"user": {
"name": "***",
"type": "servicePrincipal"
}
}
]
C:\WINDOWS\system32\cmd.exe /D /S /C ""C:\Program Files (x86)\Microsoft SDKs\Azure\CLI2\wbin\az.cmd" account set --subscription ***"
"C:\Program Files\PowerShell\7\pwsh.exe" -NoLogo -NoProfile -NonInteractive -ExecutionPolicy Unrestricted -Command ". 'C:\agentname\_work\_temp\azureclitaskscript1615887054530.ps1'"
ERROR: The command requires the extension azure-devops. Unable to prompt for extension install confirmation as no tty available. Run 'az config set extension.use_dynamic_install=yes_without_prompt' to allow installing extensions without prompt.
ERROR: The command requires the extension azure-devops. Unable to prompt for extension install confirmation as no tty available. Run 'az config set extension.use_dynamic_install=yes_without_prompt' to allow installing extensions without prompt.
##[error]Script failed with exit code: 1
C:\WINDOWS\system32\cmd.exe /D /S /C ""C:\Program Files (x86)\Microsoft SDKs\Azure\CLI2\wbin\az.cmd" account clear"
Finishing: Tag build with server version
Is there any progress on resolving this issue? I also would like to use this extension.
I had similar issue when az-devops extension was not installed under the pipeline agent running user.
can you try to add the extension as part of the pipeline or your script?
az extension add --name azure-devops
@gauravsaralMs In my case self hosted ubuntu agents it does the job! Thanks!
I encountered the same issue. @manusabu11 pointed me in the right direction. I used the following command to install the extension (note the --system
which installs it for all users).
az extension add --name azure-devops --system
I had planned to set the extension.use_dynamic_install
option as suggested in the error message, but this seems to be per user and I couldn't see an option to set this at a system level.
@sclarke81 After executing the above command in self hosted ubuntu machine facing this error An error occurred. Pip failed with status code 2. Use --debug for more information.
I am facing this error on the azure devops pipeline the pipeline is executing on the ubuntu self-hosted machine. Any solution for this error @mitsha-microsoft
ERROR: The command requires the extension azure-devops. Unable to prompt for extension install confirmation as no tty available. Run 'az config set extension.use_dynamic_install=yes_without_prompt' to allow installing extensions without prompt.
Hi @Ijtehad143 I had left the team 3 years ago and don't work with this team anymore, and I am not sure who owns this as well. Tagging @gauravsaralMs to redirect to the proper support.
Error : Az devops works locally on agent. When we ran through pipeline with CLI task ( powershell script) on agent, it throws error as az: 'devops' is not in the 'az' command group.
Also i could see the warning 'unable to load extension azure-devops' while loading.
azure-cli: 2.1.0, command-modules-nspkg: 2.0.3, core: 2.1.0, nspkg: 3.0.4, telemetry: 1.0.4 Extensions: azure-devops 0.17.0 Python location 'C:\Program Files (x86)\Microsoft SDKs\Azure\CLI2\python.exe' Extensions directory 'C:\Program Files\Common Files\AzureCliExtensionDirectory' Python (Windows) 3.6.6 (v3.6.6:4cf1f54eb7, Jun 27 2018, 02:47:15) [MSC v.1900 32 bit (Intel)]
Expected behavior AZ devops command should work with Agent through devops pipeline.
Screenshots Added Screenshot which shows unable to load extension 'azure-devops'