while connecting with Azure kubernetes cluster from windows via powershell, I am getting an error.
The command being used is -
az aks get-credentials --name clustername --resource-group rgname --subscription subsId
The command failed with an unexpected error. Here is the traceback:
'name'
Traceback (most recent call last):
File "C:\Users\VSSADM~1\AppData\Local\Temp\pip-install-qdpilz60\knack\knack\cli.py", line 206, in invoke
File "C:\Users\VSSADM~1\AppData\Local\Temp\pip-install-qdpilz60\azure-cli-core\azure\cli\core\commands\__init__.py", line 578, in execute
File "C:\Users\VSSADM~1\AppData\Local\Temp\pip-install-qdpilz60\azure-cli-core\azure\cli\core\commands\__init__.py", line 636, in _run_jobs_serially
File "C:\Users\VSSADM~1\AppData\Local\Temp\pip-install-qdpilz60\azure-cli-core\azure\cli\core\commands\__init__.py", line 629, in _run_job
File "C:\Users\VSSADM~1\AppData\Local\Temp\pip-install-qdpilz60\six\six.py", line 693, in reraise
File "C:\Users\VSSADM~1\AppData\Local\Temp\pip-install-qdpilz60\azure-cli-core\azure\cli\core\commands\__init__.py", line 606, in _run_job
File "C:\Users\VSSADM~1\AppData\Local\Temp\pip-install-qdpilz60\azure-cli-core\azure\cli\core\commands\__init__.py", line 305, in __call__
File "C:\Users\VSSADM~1\AppData\Local\Temp\pip-install-qdpilz60\azure-cli-core\azure\cli\core\__init__.py", line 485, in default_command_handler
File "C:\Users\VSSADM~1\AppData\Local\Temp\pip-install-qdpilz60\azure-cli\azure\cli\command_modules\acs\custom.py", line 1693, in aks_get_credentials
File "C:\Users\VSSADM~1\AppData\Local\Temp\pip-install-qdpilz60\azure-cli\azure\cli\command_modules\acs\custom.py", line 2422, in _print_or_merge_credentials
File "C:\Users\VSSADM~1\AppData\Local\Temp\pip-install-qdpilz60\azure-cli\azure\cli\command_modules\acs\custom.py", line 1063, in merge_kubernetes_configurations
File "C:\Users\VSSADM~1\AppData\Local\Temp\pip-install-qdpilz60\azure-cli\azure\cli\command_modules\acs\custom.py", line 1012, in _handle_merge
KeyError: 'name'
This error happens when your ~/.kube/config is structured differently than what az aks get-credentials expects, for example when certain keys are missing. See https://github.com/Azure/azure-cli/issues/10812
You can resolve this issue by deleting ~/.kube/config.
Related
I run the following "az container delete" on old cli version successfully. However, when I upgraded to 2.28.0, it failed with error
az container delete --subscription xx --resource-group xx --name xx
Errors:
The command failed with an unexpected error. Here is the traceback:
'ContainerGroupsOperations' object has no attribute 'delete'
Traceback (most recent call last):
File "D:\a\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\knack/cli.py", line 231, in invoke
File "D:\a\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/commands/__init__.py", line 657, in execute
File "D:\a\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/commands/__init__.py", line 720, in _run_jobs_serially
File "D:\a\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/commands/__init__.py", line 691, in _run_job
File "D:\a\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/commands/__init__.py", line 328, in __call__
File "D:\a\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/commands/command_operation.py", line 121, in handler
File "D:\a\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/command_modules/container/custom.py", line 66, in delete_container
AttributeError: 'ContainerGroupsOperations' object has no attribute 'delete
This is a known issue introduced by Microsoft updating Az CLI to version 2.28.0.
There is no solution other that downgrade at the moment but MS is acknowledged.
You can track the track their responses in the official repo:
https://github.com/Azure/azure-cli/issues/19475
Still, there are some workarounds to address it.
Using REST API:
RESOURCE_GROUP=my-rg
ACI_CONTAINER_NAME=containername
SUBSCRIPTION_ID="xxxxxxxxxxxxxxxxxxxxxxxx"
az rest --method delete \
--uri "/subscriptions/{subscriptionId}/resourceGroups/${RESOURCE_GROUP}/providers/Microsoft.ContainerInstance/containerGroups/${ACI_CONTAINER_NAME}?api-version=2019-12-01" \
--subscription ${SUBSCRIPTION_ID}
Using PowerShell:
Remove-AzContainerGroup -Name ${var.resourceName} -ResourceGroupName ${var.resourceGroup} -Confirm:$False
Got the same error at DevOps jobs, week ago everything was successful. Didn't find any possibilities how to change az version from UI.
https://developercommunity.visualstudio.com/t/set-up-fixed-az-cli-version-in-my-pipeline/960733
I have just installed Azure Cli and when I am trying to login to my Azure account using az login it gives me an error -
The error - Traceback (most recent call last):
File "/usr/local/Cellar/azure-cli/2.28.0/libexec/lib/python3.9/site-packages/azure/cli/core/_session.py", line 48, in load
with codecs_open(self.filename, 'r', encoding=self._encoding) as f:
File "/usr/local/Cellar/python#3.9/3.9.7/Frameworks/Python.framework/Versions/3.9/lib/python3.9/codecs.py", line 905, in open
file = builtins.open(filename, mode, buffering)
FileNotFoundError: [Errno 2] No such file or directory: '/Users/mawada14/.azure/azureProfile.json'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/Cellar/python#3.9/3.9.7/Frameworks/Python.framework/Versions/3.9/lib/python3.9/runpy.py", line 197, in _run_module_as_main
return _run_code(code, main_globals, None,
File "/usr/local/Cellar/python#3.9/3.9.7/Frameworks/Python.framework/Versions/3.9/lib/python3.9/runpy.py", line 87, in _run_code
exec(code, run_globals)
File "/usr/local/Cellar/azure-cli/2.28.0/libexec/lib/python3.9/site-packages/azure/cli/__main__.py", line 38, in <module>
az_cli = get_default_cli()
File "/usr/local/Cellar/azure-cli/2.28.0/libexec/lib/python3.9/site-packages/azure/cli/core/__init__.py", line 912, in get_default_cli
return AzCli(cli_name='az',
File "/usr/local/Cellar/azure-cli/2.28.0/libexec/lib/python3.9/site-packages/azure/cli/core/__init__.py", line 80, in __init__
ACCOUNT.load(os.path.join(azure_folder, 'azureProfile.json'))
File "/usr/local/Cellar/azure-cli/2.28.0/libexec/lib/python3.9/site-packages/azure/cli/core/_session.py", line 61, in load
self.save()
File "/usr/local/Cellar/azure-cli/2.28.0/libexec/lib/python3.9/site-packages/azure/cli/core/_session.py", line 65, in save
with codecs_open(self.filename, 'w', encoding=self._encoding) as f:
File "/usr/local/Cellar/python#3.9/3.9.7/Frameworks/Python.framework/Versions/3.9/lib/python3.9/codecs.py", line 905, in open
file = builtins.open(filename, mode, buffering)
PermissionError: [Errno 13] Permission denied: '/Users/mawada14/.azure/azureProfile.json'
I followed this Microsoft documentation and able to login my azure portal using CLI cmd az login.
For more information please refer the below links:
. Permission denied' error after running 'az login | GitHub.
.Sign in with Azure CLI | MS DOC
Delete the C:/users/your-user-name/.azure directory and reinstall Azure cli from https://learn.microsoft.com/en-us/cli/azure/install-azure-cli-windows?tabs=azure-cli It works.
Trying to set up Azure CLI on my Kali Linux. This is the version of kali.
kali#kali:~$ uname -a
Linux kali 5.5.0-kali2-amd64 #1 SMP Debian
5.5.17-1kali1 (2020-04-21) x86_64 GNU/Linux
After installation, when I run az login, it takes me to the browser where I enter required credentials that are accepted, and the browser then shows following message.
You have logged into Microsoft Azure!
However, in the shell window, it shows the following error.
kali#kali:~$ az login
You have logged in. Now let us find all the subscriptions to which you have access...
The command failed with an unexpected error. Here is the traceback:
'SubscriptionClient' object has no attribute 'config'
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/knack/cli.py", line 215, in invoke
cmd_result = self.invocation.execute(args)
File "/usr/lib/python3/dist-packages/azure/cli/core/commands/_init_.py", line 654, in execute
raise ex
File "/usr/lib/python3/dist-packages/azure/cli/core/commands/_init_.py", line 718, in _run_jobs_serially
results.append(self._run_job(expanded_arg, cmd_copy))
File "/usr/lib/python3/dist-packages/azure/cli/core/commands/_init_.py", line 711, in _run_job
six.reraise(*sys.exc_info())
File "/usr/lib/python3/dist-packages/six.py", line 703, in reraise
raise value
File "/usr/lib/python3/dist-packages/azure/cli/core/commands/_init_.py", line 688, in _run_job
result = cmd_copy(params)
File "/usr/lib/python3/dist-packages/azure/cli/core/commands/_init.py", line 325, in __call_
return self.handler(*args, **kwargs)
File "/usr/lib/python3/dist-packages/azure/cli/core/_init_.py", line 782, in default_command_handler
return op(**command_args)
File "/usr/lib/python3/dist-packages/azure/cli/command_modules/profile/custom.py", line 152, in login
subscriptions = profile.find_subscriptions_on_login(
File "/usr/lib/python3/dist-packages/azure/cli/core/_profile.py", line 195, in find_subscriptions_on_login
subscriptions = subscription_finder.find_through_authorization_code_flow(
File "/usr/lib/python3/dist-packages/azure/cli/core/_profile.py", line 849, in find_through_authorization_code_flow
result = self._find_using_common_tenant(token_entry[_ACCESS_TOKEN], resource)
File "/usr/lib/python3/dist-packages/azure/cli/core/_profile.py", line 893, in _find_using_common_tenant
client = self._arm_client_factory(token_credential)
File "/usr/lib/python3/dist-packages/azure/cli/core/_profile.py", line 812, in create_arm_client_factory
configure_common_settings(cli_ctx, client)
File "/usr/lib/python3/dist-packages/azure/cli/core/commands/client_factory.py", line 79, in configure_common_settings
client.config.enable_http_logger = True
AttributeError: 'SubscriptionClient' object has no attribute 'config'
To open an issue, please run: 'az feedback'
What does this error mean and how can this be addressed?
honestly this looks like a version mismatch on the libraries you are using? I'd probably remove az cli completely and remove all the python modules that are related to azure and reinstall it, alternatively, just use a docker image with az cli provided by microsoft:
docker run -it mcr.microsoft.com/azure-cli
Whenever I try to docker-compose up any project I get the following error.
I've tried with and without sudo
I am only having this issue on this machine. I am able to run the same containers on my Mac and Amazon WorkSpace.
(myslabs) [austin#localhost myslabs]$ sudo docker-compose up
[sudo] password for austin:
Traceback (most recent call last):
File "urllib3/connectionpool.py", line 677, in urlopen
File "urllib3/connectionpool.py", line 392, in _make_request
File "http/client.py", line 1252, in request
File "http/client.py", line 1298, in _send_request
File "http/client.py", line 1247, in endheaders
File "http/client.py", line 1026, in _send_output
File "http/client.py", line 966, in send
File "docker/transport/unixconn.py", line 43, in connect
ConnectionRefusedError: [Errno 111] Connection refused
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "requests/adapters.py", line 449, in send
File "urllib3/connectionpool.py", line 727, in urlopen
File "urllib3/util/retry.py", line 403, in increment
File "urllib3/packages/six.py", line 734, in reraise
File "urllib3/connectionpool.py", line 677, in urlopen
File "urllib3/connectionpool.py", line 392, in _make_request
File "http/client.py", line 1252, in request
File "http/client.py", line 1298, in _send_request
File "http/client.py", line 1247, in endheaders
File "http/client.py", line 1026, in _send_output
File "http/client.py", line 966, in send
File "docker/transport/unixconn.py", line 43, in connect
urllib3.exceptions.ProtocolError: ('Connection aborted.', ConnectionRefusedError(111, 'Connection refused'))
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "docker/api/client.py", line 205, in _retrieve_server_version
File "docker/api/daemon.py", line 181, in version
File "docker/utils/decorators.py", line 46, in inner
File "docker/api/client.py", line 228, in _get
File "requests/sessions.py", line 543, in get
File "requests/sessions.py", line 530, in request
File "requests/sessions.py", line 643, in send
File "requests/adapters.py", line 498, in send
requests.exceptions.ConnectionError: ('Connection aborted.', ConnectionRefusedError(111, 'Connection refused'))
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "bin/docker-compose", line 3, in <module>
File "compose/cli/main.py", line 67, in main
File "compose/cli/main.py", line 123, in perform_command
File "compose/cli/command.py", line 69, in project_from_options
File "compose/cli/command.py", line 132, in get_project
File "compose/cli/docker_client.py", line 43, in get_client
File "compose/cli/docker_client.py", line 170, in docker_client
File "docker/api/client.py", line 188, in __init__
File "docker/api/client.py", line 213, in _retrieve_server_version
docker.errors.DockerException: Error while fetching server API version: ('Connection aborted.', ConnectionRefusedError(111, 'Connection refused'))
[142201] Failed to execute script docker-compose
I've not been able to find any articles about any similar issues.
I am using Centos 8 running inside of a VirtualBox on Windows.
(myslabs) [austin#localhost myslabs]$ docker --version
Docker version 19.03.13, build 4484c46d9d
(myslabs) [austin#localhost myslabs]$ docker-compose --version
docker-compose version 1.27.3, build 4092ae5d
Any help would greatly be appreciated.
I also encountered the same error as you,My problem is that docker does not start.
check docker status systemctl status docker
systemctl start docker
docker-compose up try again
systemctl enable docker to start on boot
If you're on a Mac, it may mean that Docker itself isn't running. I had rebooted my Mac and Docker wasn't set to automatically launch at login. You can set this as a Docker preference.
If nothing works, run:
sudo chmod +x /usr/local/bin/docker-compose
sudo docker-compose up -d
If On WSL2 ensure that the docker service has been started, use sudo service docker status to check. If it is not running, use the command sudo service docker start to get it running before sudo docker-compose up
Sometimes docker service is stopped. You can check it and restart.Normally happens if error iscontainer. can pruine and start again.
Please restart docker containers and it will work fine.
This issue comes mainly in the case of windows. restart your docker container.
then run the docker command from your terminal
I have created an Asp.NET web application using Visual studio 2019 >> i publish the project to my c drive >> zip the generated files. then i wanted to deploy it to Azure web app >> i open azure command line >> i run this command:-
C:\Program Files\Microsoft SDKs\Azure\.NET SDK\v2.9>az webapp deployment source config-zip --resource-group "PUS" --name "TGPUS" --src " C:\pus\bin.zip"
But i got these exceptions:-
Getting scm site credentials for zip deployment
The command failed with an unexpected error. Here is the traceback:
[Errno 22] Invalid argument: 'C:\\Program Files\\Microsoft SDKs\\Azure\\.NET SDK\\v2.9\\ C:\\pus\\bin.zip'
Traceback (most recent call last):
File "C:\Users\VSSADM~1\AppData\Local\Temp\pip-install-64vfp5fb\knack\knack\cli.py", line 206, in invoke
File "C:\Users\VSSADM~1\AppData\Local\Temp\pip-install-64vfp5fb\azure-cli-core\azure\cli\core\commands\__init__.py", line 608, in execute
File "C:\Users\VSSADM~1\AppData\Local\Temp\pip-install-64vfp5fb\azure-cli-core\azure\cli\core\commands\__init__.py", line 666, in _run_jobs_serially
File "C:\Users\VSSADM~1\AppData\Local\Temp\pip-install-64vfp5fb\azure-cli-core\azure\cli\core\commands\__init__.py", line 659, in _run_job
File "C:\Users\VSSADM~1\AppData\Local\Temp\pip-install-64vfp5fb\six\six.py", line 696, in reraise
File "C:\Users\VSSADM~1\AppData\Local\Temp\pip-install-64vfp5fb\azure-cli-core\azure\cli\core\commands\__init__.py", line 636, in _run_job
File "C:\Users\VSSADM~1\AppData\Local\Temp\pip-install-64vfp5fb\azure-cli-core\azure\cli\core\commands\__init__.py", line 306, in __call__
File "C:\Users\VSSADM~1\AppData\Local\Temp\pip-install-64vfp5fb\azure-cli-core\azure\cli\core\__init__.py", line 493, in default_command_handler
File "C:\Users\VSSADM~1\AppData\Local\Temp\pip-install-64vfp5fb\azure-cli\azure\cli\command_modules\appservice\custom.py", line 344, in enable_zip_deploy_webapp
File "C:\Users\VSSADM~1\AppData\Local\Temp\pip-install-64vfp5fb\azure-cli\azure\cli\command_modules\appservice\custom.py", line 369, in enable_zip_deploy
OSError: [Errno 22] Invalid argument: 'C:\\Program Files\\Microsoft SDKs\\Azure\\.NET SDK\\v2.9\\ C:\\pus\\bin.zip'
To open an issue, please run: 'az feedback'
There is a tiny error in your command. For --src " C:\pus\bin.zip", there is a redundant white-space in
" C:\pus\bin.zip". Just remove the white-space, and it will work.
so the correct command should be:
az webapp deployment source config-zip --resource-group "PUS" --name "TGPUS" --src "C:\pus\bin.zip"
The screenshot of my test: