Azure devOps 2020 RTW - Cannot login to Azure CLI - Using PAT - azure

I am trying to access Azure DevOps server 2020 using the Azure CLI using the following
Link
The Token has full permission and i can access the server using the web portal from the same workstation.
RestAPI Calls to same server works from this workstation
Getting the following error
Creating connection with personal access token.
Failed to authenticate using the supplied token.
Command ran in 28.202 seconds (init: 0.286, invoke: 27.916)
Suppress exception:
Traceback (most recent call last):
File "C:\Users\VSSADM~1\AppData\Local\Temp\pip-unpacked-wheel-2g1ftftt\azure\cli\__main__.py", line 60, in <module>
File "C:\Users\VSSADM~1\AppData\Local\Temp\pip-unpacked-wheel-2g1ftftt\azure\cli\__main__.py", line 53, in <module>
SystemExit: 1
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Users\VSSADM~1\AppData\Local\Temp\pip-unpacked-wheel-_1bqfhco\azure\cli\core\_profile.py", line 502, in get_current_account_user
File "C:\Users\VSSADM~1\AppData\Local\Temp\pip-unpacked-wheel-_1bqfhco\azure\cli\core\_profile.py", line 511, in get_subscription
knack.util.CLIError: Please run 'az login' to setup account.
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Users\VSSADM~1\AppData\Local\Temp\pip-unpacked-wheel-_1bqfhco\azure\cli\core\decorators.py", line 74, in _wrapped_func
File "C:\Users\VSSADM~1\AppData\Local\Temp\pip-unpacked-wheel-_1bqfhco\azure\cli\core\decorators.py", line 57, in _decorator
File "C:\Users\VSSADM~1\AppData\Local\Temp\pip-unpacked-wheel-_1bqfhco\azure\cli\core\telemetry.py", line 522, in _get_user_azure_id
File "C:\Users\VSSADM~1\AppData\Local\Temp\pip-unpacked-wheel-_1bqfhco\azure\cli\core\_profile.py", line 504, in get_current_account_user
knack.util.CLIError: There are no active accounts.
Suppress exception:
Traceback (most recent call last):
File "C:\Users\VSSADM~1\AppData\Local\Temp\pip-unpacked-wheel-2g1ftftt\azure\cli\__main__.py", line 60, in <module>
File "C:\Users\VSSADM~1\AppData\Local\Temp\pip-unpacked-wheel-2g1ftftt\azure\cli\__main__.py", line 53, in <module>
SystemExit: 1
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Users\VSSADM~1\AppData\Local\Temp\pip-unpacked-wheel-_1bqfhco\azure\cli\core\decorators.py", line 74, in _wrapped_func
File "C:\Users\VSSADM~1\AppData\Local\Temp\pip-unpacked-wheel-_1bqfhco\azure\cli\core\telemetry.py", line 532, in _get_azure_subscription_id
File "C:\Users\VSSADM~1\AppData\Local\Temp\pip-unpacked-wheel-_1bqfhco\azure\cli\core\_profile.py", line 528, in get_subscription_id
File "C:\Users\VSSADM~1\AppData\Local\Temp\pip-unpacked-wheel-_1bqfhco\azure\cli\core\_profile.py", line 511, in get_subscription
knack.util.CLIError: Please run 'az login' to setup account.

My Solution was
Install The Beta Version of the Azure-Cli - https://aka.ms/installazurecliwindowsbeta
Set The following REQUESTS_CA_BUNDLE - PEM format

Related

Python3 ArcPy path/permissions setting error sd Hosted Services

Traceback (most recent call last):
File "<string>", line 34, in <module>
File "C:\Program Files\ArcGIS\Pro\Resources\ArcPy\arcpy\mp.py", line 105, in CreateWebLayerSDDraft
return _convertArcObjectToPythonObject(arcgisscripting._mapping.CreateWebLayerSDDraft(*_gp_fixargs([map_or_layers, out_sddraft, service_name, server_type, service_type, folder_name, overwrite_existing_service, copy_data_to_server, enable_editing, allow_exporting, enable_sync, summary, tags, description, credits, use_limitations], True)))
ValueError: Staging path is invalid or inaccessible: C:\Users\hagerty_finn\Documents\ArcGIS\Projects\TrafficFatalityCount\temp.txt
Line 34:
arcpy.mp.CreateWebLayerSDDraft(mp, sddraft, sd_fs_name, 'MY_HOSTED_SERVICES', 'FEATURE_ACCESS')
I tried changing the file path to another user and updating the password. The problem persists. I am running this script in ArcGIS Pro Python window on a GIS local server.

How to make docker-credential-pass be accessible by another user on the system?

I have installed gitlab-runner which by default creates the user gitlab-runner on the system and add it to docker group. I have decided to try to docker login from gitlab-runner shell account to investigate the reason of why I am getting error regarding login on my pipeline. I have noticed that when trying to logout my default user freshuser from the the whole system via the GUI and login with gitlab-runner user it works and it prompts me to write a passphrase but when I am on the default system user freshuser I don't get the passphrase prompt for the docker-credential-pass helper. So I tried to login and it stored the password. The same thing when I wanted to create the key for storing docker login creds with GnuPG the password prompt won't show up only when I login with gitlab-runner. Notice this happens too when pushing to container registry. Can anyone tell me what's going on I am confused?
I keep getting this error:
Traceback (most recent call last):
File "/usr/lib/python3.9/site-packages/docker/credentials/store.py", line 79, in _execute
output = subprocess.check_output(
File "/usr/lib/python3.9/subprocess.py", line 424, in check_output
return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
File "/usr/lib/python3.9/subprocess.py", line 528, in run
raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command '['/usr/bin/docker-credential-pass', 'get']' returned non-zero exit status 1.
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/lib/python3.9/site-packages/docker/auth.py", line 264, in _resolve_authconfig_credstore
data = store.get(registry)
File "/usr/lib/python3.9/site-packages/docker/credentials/store.py", line 35, in get
data = self._execute('get', server)
File "/usr/lib/python3.9/site-packages/docker/credentials/store.py", line 93, in _execute
raise errors.process_store_error(e, self.program)
docker.credentials.errors.StoreError: Credentials store docker-credential-pass exited with "exit status 2: gpg: decryption failed: No secret key".
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/bin/docker-compose", line 33, in <module>
sys.exit(load_entry_point('docker-compose==1.29.2', 'console_scripts', 'docker-compose')())
File "/usr/lib/python3.9/site-packages/compose/cli/main.py", line 81, in main
command_func()
File "/usr/lib/python3.9/site-packages/compose/cli/main.py", line 203, in perform_command
handler(command, command_options)
File "/usr/lib/python3.9/site-packages/compose/metrics/decorator.py", line 18, in wrapper
result = fn(*args, **kwargs)
File "/usr/lib/python3.9/site-packages/compose/cli/main.py", line 862, in push
self.project.push(
File "/usr/lib/python3.9/site-packages/compose/project.py", line 828, in push
service.push(ignore_push_failures)
File "/usr/lib/python3.9/site-packages/compose/service.py", line 1260, in push
output = self.client.push(repo, tag=tag, stream=True)
File "/usr/lib/python3.9/site-packages/docker/api/image.py", line 480, in push
header = auth.get_config_header(self, registry)
File "/usr/lib/python3.9/site-packages/docker/auth.py", line 47, in get_config_header
authcfg = resolve_authconfig(
File "/usr/lib/python3.9/site-packages/docker/auth.py", line 324, in resolve_authconfig
return authconfig.resolve
_authconfig(registry)
File "/usr/lib/python3.9/site-packages/docker/auth.py", line 235, in resolve_authconfig
cfg = self._resolve_authconfig_credstore(registry, store_name)
File "/usr/lib/python3.9/site-packages/docker/auth.py", line 280, in _resolve_authconfig_credstore
raise errors.DockerException(
docker.errors.DockerException: Credentials store error: StoreError('Credentials store docker-credential-pass exited with "exit status 2: gpg: decryption failed: No secret key".')
UPDATE: I have tried to add the user gitlab-runner to the default system user group but still no luck.
Passphrase prompt that I get when system logged in from gitlab-runner account:
I just found answer from here I had to add the gitlab-runner to control list to be able to use the display:
https://askubuntu.com/questions/654966/enable-x-display-access-for-local-user

Unable to access Smartsheet using Python SDK

I'm running the following code to access Smartsheet using Python SDK
access_token = 'XXXX'
smartsheet_client = smartsheet.Smartsheet(access_token)
user_profile = smartsheet_client.Users.get_current_user()
print(user_profile)
But I'm getting the following error
Traceback (most recent call last):
File "D:\Users\rahul\AppData\Local\Programs\Python\Python35-32\lib\site- Traceback (most recent call last):
File "D:\Users\rahul\AppData\Local\Programs\Python\Python35-32\lib\site-packages\urllib3\connection.py", line 157, in _new_conn
(self._dns_host, self.port), self.timeout, **extra_kw
File "D:\Users\rahul\AppData\Local\Programs\Python\Python35-32\lib\site-packages\urllib3\util\connection.py", line 61, in create_connection
for res in socket.getaddrinfo(host, port, family, socket.SOCK_STREAM):
Can anyone help me resolve this issue?
I'm using smartsheet-python-sdk.
I cannot run from work location
If you are having connection errors from your work location you might have to use a proxy with the Smartsheet Python SDK to connect.
There is info on using a proxy with the Python SDK in the Advanced topics file in the GitHub repo here:
https://github.com/smartsheet-platform/smartsheet-python-sdk/blob/master/ADVANCED.md#http-proxy

Having trouble catching an exception in python 3

Working with Python 3.7.3, still figuring out how exception handling works.
I'm writing an xmpp bot, using slixmpp. I'm trying to make it so that if it loses connection to the server, it will try to reconnect. There doesn't seem to be any way to do this built in to slixmpp, so I'm write something into my own code to do it.
I've imported slixmpp as xmpp, and using it's send_raw() method to test that we're still connected to the server.
while True:
time.sleep(5) # Send every 5 seconds just for testing purposes
xmpp.send_raw('aroo?')
When I sever the connection to the server, this is what it spits out:
Traceback (most recent call last):
File "C:\Program Files\Python37\lib\threading.py", line 917, in _bootstrap_inner
self.run()
File "testcom.py", line 19, in run
eval(self.thing)()
File "testcom.py", line 28, in check_conn
xmpp.send_raw('aroo?')
File "C:\Program Files\Python37\lib\site-packages\slixmpp\xmlstream\xmlstream.py", line 926, in send_raw
raise NotConnectedError
slixmpp.xmlstream.xmlstream.NotConnectedError
I'm assuming that "NotConnectedError" is the exception that I need to catch, so I put the code inside a try block, like so:
try:
while True:
time.sleep(5) # Send every 5 seconds just for testing purposes
xmpp.send_raw('aroo?')
except NotConnectedError:
# Do a thing
pass
And this is what I get:
Traceback (most recent call last):
File "testcom.py", line 28, in check_conn
xmpp.send_raw('aroo?')
File "C:\Program Files\Python37\lib\site-packages\slixmpp\xmlstream\xmlstream.py", line 926, in send_raw
raise NotConnectedError()
slixmpp.xmlstream.xmlstream.NotConnectedError
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Program Files\Python37\lib\threading.py", line 917, in _bootstrap_inner
self.run()
"testcom.py", line 19, in run
eval(self.thing)()
File "testcom.py", line 29, in check_conn
except NotConnectedError:
NameError: name 'NotConnectedError' is not defined
Can anyone tell me what I'm doing wrong here?
Thanks!
I can't see your imports but make sure you have from slixmpp.xmlstream.xmlstream import NotConnectedError otherwise it doesn't have a definition for NotConnectedError within the application. You could also change NotConnectedError to xmpp.xmlstream.xmlstream.NotConnectedError if you don't want to have it imported as well.

python 3 exception also gives the output of the previous program

i ran into an interesting bug when writing a json parser(called /home/myusername/py/json.py) in python3
i raised a basic exception and got unexpected output,
when investigating this further i wrote a new script entirely given below
/home/myusername/py/error.py
raise Exception("basic exception")
after running "python3 error.py"
i should get a really short error message, but instead i get console output of the previous run program.
[unexpected debug output of json.py]
[truncated for readability]
[it is extremely long but does not contain further errors]
Traceback (most recent call last):
File "error.py", line 1, in <module>
raise Exception("basic exception")
Exception: basic exception
Error in sys.excepthook:
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/apport_python_hook.py", line 63, in apport_excepthook
from apport.fileutils import likely_packaged, get_recent_crashes
File "/usr/lib/python3/dist-packages/apport/__init__.py", line 5, in <module>
from apport.report import Report
File "/usr/lib/python3/dist-packages/apport/report.py", line 30, in <module>
import apport.fileutils
File "/usr/lib/python3/dist-packages/apport/fileutils.py", line 23, in <module>
from apport.packaging_impl import impl as packaging
File "/usr/lib/python3/dist-packages/apport/packaging_impl.py", line 17, in <module>
import json
File "/home/myusername/py/json.py", line 174, in <module>
rs = parser.Object(testcase)
File "/home/myusername/py/json.py", line 104, in Object
raise Exception(self.Array(source, "crashing object scanner"))
Exception: None
Original exception was:
Traceback (most recent call last):
File "error.py", line 1, in <module>
raise Exception("basic exception")
Exception: basic exception
i dont know why i get such a long message. nor do i know why i get debug code of an uncalled script. i would like an explanation, i am running Ubuntu, i have not yet found related bugs on the internet.
it appears that basic exception handling requires a json.py script, so when my error.py raises an exception it loads my json.py script instead of the buildin script, then my json script trows an exception.
the solution is to rename my json.py

Resources