Skip to content

Commit

Permalink
update readme and triubleshooting
Browse files Browse the repository at this point in the history
  • Loading branch information
KarishmaGhiya committed Oct 11, 2021
1 parent 7f59f2f commit 68200de
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 4 deletions.
8 changes: 7 additions & 1 deletion sdk/identity/identity/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,13 @@ Credentials raise `AuthenticationError` when they fail to authenticate. This cla

### Logging

Enabling logging may help uncover useful information about failures. In order to see a log of HTTP requests and responses, set the `AZURE_LOG_LEVEL` environment variable to `info`. Alternatively, logging can be enabled at runtime by calling `setLogLevel` in the `@azure/logger`:
Enabling logging may help uncover useful information about failures. In order to see a log of HTTP requests and responses, set the `AZURE_LOG_LEVEL` environment variable to `info`. You can read this environment variable from the .env by explicitly specifying a path for the file:

```javascript
require("dotenv").config({ path: ".env" });
```

Alternatively, logging can be enabled at runtime by calling `setLogLevel` in the `@azure/logger`:

```javascript
import { setLogLevel } from "@azure/logger";
Expand Down
19 changes: 16 additions & 3 deletions sdk/identity/identity/Troubleshooting.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,18 @@ Please follow the configuration instructions in the `Credential Unvavailable` se
| Azure CLI Credential | [Azure CLI Troubleshooting Guide](#troubleshooting-azure-cli-authentication-issues) |
| Azure Powershell Credential | [Azure Powershell Troubleshooting Guide](#troubleshooting-azure-powershell-authentication-issues) |

## Logging

To help diagnose any errors in credentials that encompass multiple credentials like `DefaultAzureCredential`, [enabling logging](https://github.com/azure-sdk/azure-sdk-for-js/blob/main/sdk/identity/identity/README.md) will also help you get a better understanding.

Consider a scenario where you have these environment variables set up either in your environment or .env file - `AZURE_TENANT_ID`, `AZURE_CLIENT_ID`, `AZURE_CLIENT_SECRET` You authenticate using `DefaultAzureCredential` and enable logging.
You will see the following logging statements -

```
azure:identity:info EnvironmentCredential => Found the following environment variables: AZURE_TENANT_ID, AZURE_CLIENT_ID, AZURE_CLIENT_SECRET
azure:identity:info EnvironmentCredential => Invoking ClientSecretCredential with tenant ID: 72f988bf-86f1-41af-91ab-2d7cd011db47, clientId: f850650c-1fcf-4489-b46f-71af2e30d360 and clientSecret: [REDACTED]
```

## Troubleshooting Application Credential Authentication Issues

### Credential Unavailable Error
Expand Down Expand Up @@ -227,8 +239,9 @@ The `Azure Powershell Credential` utilizes the locally installed `Powershell` co
#### Azure Az Moudle Not Installed.

The `Azure Powershell Credential` failed to execute as Azure az module is not installed.
To use Azure Powershell credential, the Azure az module needs to be installed. Install the Azure Az PowerShell module with:
```ps
To use Azure Powershell credential, the Azure az module needs to be installed. Install the Azure Az PowerShell module with:

````ps
Install-Module -Name Az -Scope CurrentUser -Repository PSGallery -Force
to install it for your platform and then try running the credential again.
Expand All @@ -246,7 +259,7 @@ In your local powershell window, run the following command to ensure that Azure
```pwsh
Get-AzAccessToken -ResourceUrl "<Scopes-Url>"
```
````

In the event above command is not working properly, follow the instructions to resolve the Azure Powershell issue being faced and then try running the credential again.

Expand Down

0 comments on commit 68200de

Please sign in to comment.