Skip to content

Commit 7ba8baf

Browse files
authored
use azd auth login (Azure#30041)
1 parent 0d42467 commit 7ba8baf

File tree

6 files changed

+14
-14
lines changed

6 files changed

+14
-14
lines changed

sdk/identity/azure-identity/README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,9 @@ When no default browser is available, `az login` will use the device code authen
4545

4646
Developers coding outside of an IDE can also use the [Azure Developer CLI][azure_developer_cli] to authenticate. Applications using the `DefaultAzureCredential` or the `AzureDeveloperCliCredential` can then use this account to authenticate calls in their application when running locally.
4747

48-
To authenticate with the [Azure Developer CLI][azure_developer_cli], users can run the command `azd login`. For users running on a system with a default web browser, the Azure Developer CLI will launch the browser to authenticate the user.
48+
To authenticate with the [Azure Developer CLI][azure_developer_cli], users can run the command `azd auth login`. For users running on a system with a default web browser, the Azure Developer CLI will launch the browser to authenticate the user.
4949

50-
For systems without a default web browser, the `azd login --use-device-code` command will use the device code authentication flow.
50+
For systems without a default web browser, the `azd auth login --use-device-code` command will use the device code authentication flow.
5151

5252
## Key concepts
5353

@@ -70,7 +70,7 @@ The Azure Identity library focuses on OAuth authentication with Azure AD. It off
7070
1. **Environment** - `DefaultAzureCredential` will read account information specified via [environment variables](#environment-variables "environment variables") and use it to authenticate.
7171
1. **Workload Identity** - If the application is deployed to Azure Kubernetes Service with Managed Identity enabled, `DefaultAzureCredential` will authenticate with it.
7272
1. **Managed Identity** - If the application is deployed to an Azure host with Managed Identity enabled, `DefaultAzureCredential` will authenticate with it.
73-
1. **Azure Developer CLI** - If the developer has authenticated via the Azure Developer CLI `azd login` command, the `DefaultAzureCredential` will authenticate with that account.
73+
1. **Azure Developer CLI** - If the developer has authenticated via the Azure Developer CLI `azd auth login` command, the `DefaultAzureCredential` will authenticate with that account.
7474
1. **Azure CLI** - If a user has signed in via the Azure CLI `az login` command, `DefaultAzureCredential` will authenticate as that user.
7575
1. **Azure PowerShell** - If a user has signed in via Azure PowerShell's `Connect-AzAccount` command, `DefaultAzureCredential` will authenticate as that user.
7676
1. **Interactive browser** - If enabled, `DefaultAzureCredential` will interactively authenticate a user via the default browser. This credential type is disabled by default.

sdk/identity/azure-identity/TROUBLESHOOTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,7 @@ az account get-access-token --output json --resource https://management.core.win
231231
| Error Message |Description| Mitigation |
232232
|---|---|---|
233233
|Azure Developer CLI could not be found|The Azure Developer CLI isn't installed or couldn't be found.|<ul><li>Ensure the Azure Developer CLI is properly installed. Installation instructions can be found [here](https://learn.microsoft.com/azure/developer/azure-developer-cli/install-azd).</li><li>Validate the installation location has been added to the `PATH` environment variable.</li></ul>|
234-
|Please run 'azd login' to set up account|No account is currently logged into the Azure Developer CLI, or the login has expired.|<ul><li>Log into the Azure Developer CLI using the `azd login` command.</li><li>Validate that the Azure Developer CLI can obtain tokens. See [below](#verify-the-azure-developer-cli-can-obtain-tokens) for instructions.</li></ul>|
234+
|Please run 'azd auth login' to set up account|No account is currently logged into the Azure Developer CLI, or the login has expired.|<ul><li>Log into the Azure Developer CLI using the `azd auth login` command.</li><li>Validate that the Azure Developer CLI can obtain tokens. See [below](#verify-the-azure-developer-cli-can-obtain-tokens) for instructions.</li></ul>|
235235

236236
#### __Verify the Azure Developer CLI can obtain tokens__
237237

sdk/identity/azure-identity/azure/identity/_credentials/azd_cli.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,10 @@
2222

2323
CLI_NOT_FOUND = 'Azure Developer CLI could not be found. '\
2424
'Please visit https://aka.ms/azure-dev for installation instructions and then,'\
25-
'once installed, authenticate to your Azure account using \'azd login\'.'
25+
'once installed, authenticate to your Azure account using \'azd auth login\'.'
2626
COMMAND_LINE = "azd auth token --output json --scope {}"
2727
EXECUTABLE_NAME = "azd"
28-
NOT_LOGGED_IN = "Please run 'azd login' from a command prompt to authenticate before using this credential."
28+
NOT_LOGGED_IN = "Please run 'azd auth login' from a command prompt to authenticate before using this credential."
2929

3030

3131
class AzureDeveloperCliCredential:
@@ -43,8 +43,8 @@ class AzureDeveloperCliCredential:
4343
To use this credential, the developer needs to authenticate locally in Azure Developer CLI using one of the
4444
commands below:
4545
46-
* Run "azd login" in Azure Developer CLI to authenticate interactively as a user.
47-
* Run "azd login --client-id 'client_id' --client-secret 'client_secret' --tenant-id 'tenant_id'"
46+
* Run "azd auth login" in Azure Developer CLI to authenticate interactively as a user.
47+
* Run "azd auth login --client-id 'client_id' --client-secret 'client_secret' --tenant-id 'tenant_id'"
4848
to authenticate as a service principal.
4949
5050
You may need to repeat this process after a certain time period, depending on the refresh token validity in your
@@ -194,7 +194,7 @@ def _run_command(command: str, timeout: int) -> str:
194194
# Fallback check in case the executable is not found while executing subprocess.
195195
if ex.returncode == 127 or ex.stderr.startswith("'azd' is not recognized"):
196196
raise CredentialUnavailableError(message=CLI_NOT_FOUND)
197-
if "not logged in, run `azd login` to login" in ex.stderr:
197+
if "not logged in, run `azd auth login` to login" in ex.stderr:
198198
raise CredentialUnavailableError(message=NOT_LOGGED_IN)
199199

200200
# return code is from the CLI -> propagate its output

sdk/identity/azure-identity/azure/identity/aio/_credentials/azd_cli.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,8 @@ class AzureDeveloperCliCredential(AsyncContextManager):
4141
To use this credential, the developer needs to authenticate locally in Azure Developer CLI using one of the
4242
commands below:
4343
44-
* Run "azd login" in Azure Developer CLI to authenticate interactively as a user.
45-
* Run "azd login --client-id 'client_id' --client-secret 'client_secret' --tenant-id 'tenant_id'"
44+
* Run "azd auth login" in Azure Developer CLI to authenticate interactively as a user.
45+
* Run "azd auth login --client-id 'client_id' --client-secret 'client_secret' --tenant-id 'tenant_id'"
4646
to authenticate as a service principal.
4747
4848
You may need to repeat this process after a certain time period, depending on the refresh token validity in your
@@ -164,7 +164,7 @@ async def _run_command(command: str, timeout: int) -> str:
164164
if proc.returncode == 127 or stderr.startswith("'azd' is not recognized"):
165165
raise CredentialUnavailableError(CLI_NOT_FOUND)
166166

167-
if "not logged in, run `azd login` to login" in stderr:
167+
if "not logged in, run `azd auth login` to login" in stderr:
168168
raise CredentialUnavailableError(message=NOT_LOGGED_IN)
169169

170170
message = sanitize_output(stderr) if stderr else "Failed to invoke Azure Developer CLI"

sdk/identity/azure-identity/tests/test_azd_cli_credential.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ def test_cannot_execute_shell():
8585
def test_not_logged_in():
8686
"""When the CLI isn't logged in, the credential should raise CredentialUnavailableError"""
8787

88-
stderr = "ERROR: not logged in, run `azd login` to login"
88+
stderr = "ERROR: not logged in, run `azd auth login` to login"
8989
with mock.patch("shutil.which", return_value="azd"):
9090
with mock.patch(CHECK_OUTPUT, raise_called_process_error(1, stderr=stderr)):
9191
with pytest.raises(CredentialUnavailableError, match=NOT_LOGGED_IN):

sdk/identity/azure-identity/tests/test_azd_cli_credential_async.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ async def test_cannot_execute_shell():
114114
async def test_not_logged_in():
115115
"""When the CLI isn't logged in, the credential should raise CredentialUnavailableError"""
116116

117-
stderr = "ERROR: not logged in, run `azd login` to login"
117+
stderr = "ERROR: not logged in, run `azd auth login` to login"
118118
with mock.patch("shutil.which", return_value="azd"):
119119
with mock.patch(SUBPROCESS_EXEC, mock_exec("", stderr, return_code=1)):
120120
with pytest.raises(CredentialUnavailableError, match=NOT_LOGGED_IN):

0 commit comments

Comments
 (0)