Closed spdjudd closed 6 years ago
Thanks for reporting this. However, I was not able to repro this issue with azure-4.0.0 and azure-mgmt-batchai-2.0.0. Can you please try to do a clean installation of azure and azure-mgmt-batchai, e.g in a new virtual environment, to see if the issue still exists?
@spdjudd I am able to repro this issue on MacOS, but not Windows... Still investigating and will keep updating
I was able to see the issue on clean Windows and Linux, didn't try Mac :) I'm away at the moment but can get more details when I'm back. Thanks for investigating!
Ok, I have a simple way to reproduce, and I can see where the problem arises.
Steps to reproduce:
Assuming you have cloned the repo locally and run the steps to create configuration.json
, run the following docker commands:
docker pull continuumio/anaconda3
docker run -it -p 8888:8888 -v <local-path-to-this-repo>:/home/azurebatchai continuumio/anaconda3 /bin/bash
In the bash prompt, install the azure and batchai packages, and run jupyter:
pip install azure
pip install azure-mgmt-batchai --upgrade
cd /home/azurebatchai
jupyter notebook --ip='*' --port=8888 --no-browser --allow-root
Now when I browse to the jupyter url and run the recipe notebooks, this step fails with the error in my original post:
client = utils.config.create_batchai_client(cfg)
If I repeat the process but install azure version 3.0 (pip install azure==3.0
instead of pip install azure
) instead of latest, it works.
Cause:
The call that fails is a POST to https://login.microsoftonline.com/common/oauth2/token
. The previous version results in a POST to a similar URL but with a GUID - the aad_tenant
in place of 'common', which succeeds.
I think the new version of azure.common.credentials.ServicePrincipalCredentials
ignores the token_uri
parameter (BatchAI/utilities/config.py line 75), and instead builds the URI itself.
If I change BatchAI/utilities/config.py to parse out the aad_tenant
field and pass that in as the tenant
parameter then the new version generates the correct URI and the call succeeds. I'm happy to submit that as a pull request if it helps?
@spdjudd Thank you very much for your report and analysis. Yes, please go ahead to submit a PR for the fix and we much appreciate your help!
When I follow the installation instructions here in a clean environment,
pip install azure
installs version 4.0.0. When I run the recipe code it fails when callingbatchai_client_create
, with this error:AdalError: Get Token request returned http error: 400 and server response: {"error":"unauthorized_client","error_description":"AADSTS70001: Application with identifier 'xxxxxxxxxx' was not found in the directory management.core.windows.net
If I revert to azure 2.0.0 it works fine. It looks like azure 4.0.0 was just released a couple of days ago and is somehow not compatible with azure-mgmt-batchai 2.0.0?