As of 2019-07, this looks to be resolved. It's still possible to run into hiccups, but it works when one avoids edge cases.
[Without logging in to the azure CLI]
$ juju add-credential azure Enter credential name: az-test
Auth Types interactive service-principal-secret
Select auth type [interactive]:
Enter subscription-id: ed185b28-....-....-....-........bfc3
Initiating interactive authentication.
To sign in, use a web browser to open the page https://microsoft.com/devicelogin and enter the code HD3S77LNH to authenticate.
Authenticated as "c64de0e0-....-....-....-9f05be734b4c 33a8a870-....-....-....-71642935532b". ERROR finalizing credential: service principal not found
[After logging in with `az login`]
$ juju add-credential azure Enter credential name: az-test2
Enter subscription-id (optional): ed185b28-....-....-....-........bfc3
To sign in, use a web browser to open the page https://microsoft.com/devicelogin and enter the code H3QPPZVX6 to authenticate.
Authenticated as "c64de0e0-....-....-....-9f05be734b4c 33a8a870-....-....-....-71642935532b". Credential "az-test2" added locally for cloud "azure".
As of 2019-07, this looks to be resolved. It's still possible to run into hiccups, but it works when one avoids edge cases.
[Without logging in to the azure CLI]
$ juju add-credential azure
Enter credential name: az-test
Auth Types principal- secret
interactive
service-
Select auth type [interactive]:
Enter subscription-id: ed185b28- ....-.. ..-.... -...... ..bfc3
Initiating interactive authentication.
To sign in, use a web browser to open the page https:/ /microsoft. com/devicelogin and enter the code HD3S77LNH to authenticate.
Authenticated as "c64de0e0- ....-.. ..-.... -9f05be734b4c 33a8a870- ....-.. ..-.... -71642935532b" .
ERROR finalizing credential: service principal not found
[After logging in with `az login`]
$ juju add-credential azure
Enter credential name: az-test2
Auth Types principal- secret
interactive
service-
Select auth type [interactive]:
Enter subscription-id (optional): ed185b28- ....-.. ..-.... -...... ..bfc3
Initiating interactive authentication.
To sign in, use a web browser to open the page https:/ /microsoft. com/devicelogin and enter the code H3QPPZVX6 to authenticate.
Authenticated as "c64de0e0- ....-.. ..-.... -9f05be734b4c 33a8a870- ....-.. ..-.... -71642935532b" .
Credential "az-test2" added locally for cloud "azure".