Azure / azure-sdk-for-ruby

Ruby SDK for Azure Resource Manager: build and manage your Azure cloud infrastructure (Compute, Virtual Networks, Storage, etc...) using Ruby.
MIT License
275 stars 246 forks source link

'Error acquiring token from the Azure CLI' due to wrong cli_path #2852

Closed hunter86bg closed 1 year ago

hunter86bg commented 1 year ago

It seems that File.join returns an invalid cli_path like this on Server2019 and Windows 10:

irb(main):002:1* ENV['PATH'].split(File::PATH_SEPARATOR).each do |path|
irb(main):003:2*   exts.each do |ext|
irb(main):004:2*     executable = File.join(path, "az#{ext}")
irb(main):005:2*     puts executable if File.executable?(executable) && !File.directory?(executable)
irb(main):006:1*   end
irb(main):007:0> end
C:\Program Files (x86)\Microsoft SDKs\Azure\CLI2\wbin/az.CMD
=>
<OUTPUT TRUNCATED>

This leads to triggering the rescue in acquire_token().

hunter86bg commented 1 year ago

https://github.com/Azure/azure-sdk-for-ruby/pull/2853 theoretically should fix it:

irb(main):042:1* ENV['PATH'].split(File::PATH_SEPARATOR).each do |path|
irb(main):043:2*   exts.each do |ext|
irb(main):044:2*     executable = File.join(path, "az#{ext}").gsub(File::SEPARATOR, File::ALT_SEPARATOR || File::SEPARATOR)
irb(main):045:2*     puts executable if File.executable?(executable) && !File.directory?(executable)
irb(main):046:1*   end
irb(main):047:0> end
C:\Program Files (x86)\Microsoft SDKs\Azure\CLI2\wbin\az.CMD
=>
<OUTPUT TRUNCATED>
kurtzeborn commented 1 year ago

Thank you for your interest in Azure SDKs. As detailed in this retirement announcement, this repo is no longer supported as of December 31st 2021. Please find the up-to-date list of languages and services supported with Azure SDKs here: https://aka.ms/azsdk