Skip to content

Commit bfeed7a

Browse files
authored
Add troubleshooting links to relevant errors (Azure#18676)
1 parent d44aa05 commit bfeed7a

File tree

3 files changed

+22
-0
lines changed

3 files changed

+22
-0
lines changed

sdk/azidentity/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@
5050
### Other Changes
5151
* `GetToken()` returns an error when the caller specifies no scope
5252
* Updated to the latest versions of `golang.org/x/crypto`, `azcore` and `internal`
53+
* Updated AuthenicationFailedError to include links to TROUBLESHOOTING.md for relevant errors
5354

5455
## 0.14.0 (2022-04-05)
5556

sdk/azidentity/TROUBLESHOOTING.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,7 @@ azlog.SetEvents(azidentity.EventAuthentication)
8888
|---|---|---|
8989
|Missing or incomplete environment variable configuration|A valid combination of environment variables wasn't set|Ensure the appropriate environment variables are set for the intended authentication method as described in the [module documentation](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azidentity#EnvironmentCredential)|
9090

91+
<a id="client-secret"></a>
9192
## Troubleshoot ClientSecretCredential authentication issues
9293

9394
| Error Code | Issue | Mitigation |
@@ -96,19 +97,22 @@ azlog.SetEvents(azidentity.EventAuthentication)
9697
|AADSTS7000222|An expired client secret was provided.|Create a new client secret using the Azure portal. Details on creating a new client secret are in [Azure AD documentation](https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal#option-2-create-a-new-application-secret).|
9798
|AADSTS700016|The specified application wasn't found in the specified tenant.|Ensure the client and tenant IDs provided to the credential constructor are correct for your application registration. For multi-tenant apps, ensure the application has been added to the desired tenant by a tenant admin. To add a new application in the desired tenant, follow the [Azure AD instructions](https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal).|
9899

100+
<a id="client-cert"></a>
99101
## Troubleshoot ClientCertificateCredential authentication issues
100102

101103
| Error Code | Description | Mitigation |
102104
|---|---|---|
103105
|AADSTS700027|Client assertion contains an invalid signature.|Ensure the specified certificate has been uploaded to the application registration as described in [Azure AD documentation](https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal#option-1-upload-a-certificate).|
104106
|AADSTS700016|The specified application wasn't found in the specified tenant.|Ensure the client and tenant IDs provided to the credential constructor are correct for your application registration. For multi-tenant apps, ensure the application has been added to the desired tenant by a tenant admin. To add a new application in the desired tenant, follow the [Azure AD instructions](https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal).|
105107

108+
<a id="username-password"></a>
106109
## Troubleshoot UsernamePasswordCredential authentication issues
107110

108111
| Error Code | Issue | Mitigation |
109112
|---|---|---|
110113
|AADSTS50126|The provided username or password is invalid.|Ensure the username and password provided to the credential constructor are valid.|
111114

115+
<a id="managed-id"></a>
112116
## Troubleshoot ManagedIdentityCredential authentication issues
113117

114118
`ManagedIdentityCredential` is designed to work on a variety of Azure hosts support managed identity. Configuration and troubleshooting vary from host to host. The below table lists the Azure hosts that can be assigned a managed identity and are supported by `ManagedIdentityCredential`.
@@ -164,6 +168,7 @@ curl "$IDENTITY_ENDPOINT?resource=https://management.core.windows.net&api-versio
164168
|---|---|---|
165169
|"no azure identity found for request clientID"|The application attempted to authenticate before an identity was assigned to its pod|Verify the pod is labeled correctly. This also occurs when a correctly labeled pod authenticates before the identity is ready. To prevent initialization races, configure NMI to set the Retry-After header in its responses as described in [Pod Identity documentation](https://azure.github.io/aad-pod-identity/docs/configure/feature_flags/#set-retry-after-header-in-nmi-response).
166170

171+
<a id="azure-cli"></a>
167172
## Troubleshoot AzureCliCredential authentication issues
168173

169174
| Error Message |Description| Mitigation |

sdk/azidentity/errors.go

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,22 @@ func (e *AuthenticationFailedError) Error() string {
7575
fmt.Fprint(msg, "Response contained no body")
7676
}
7777
fmt.Fprintln(msg, "\n--------------------------------------------------------------------------------")
78+
var anchor string
79+
switch e.credType {
80+
case credNameAzureCLI:
81+
anchor = "azure-cli"
82+
case credNameCert:
83+
anchor = "client-cert"
84+
case credNameSecret:
85+
anchor = "client-secret"
86+
case credNameManagedIdentity:
87+
anchor = "managed-id"
88+
case credNameUserPassword:
89+
anchor = "username-password"
90+
}
91+
if anchor != "" {
92+
fmt.Fprintf(msg, "To troubleshoot, visit https://aka.ms/azsdk/go/identity/troubleshoot#%s", anchor)
93+
}
7894
return msg.String()
7995
}
8096

0 commit comments

Comments
 (0)