Freigeben über


Debugging FaultException: authN failed: ‘…’ of PasswordCredential

Ever see “FaultException: authN failed: ‘…’ of PasswordCredential” when trying to call a method that uses Windows Azure and the Access Control Service? The issue is simply that the password is not correct.

For example, here’s a snippet of a client trying to call a method in a Windows Azure service (“MyEndpoint”), which will throw the FaultException. (Assume that my solution name is “PineCreek”, and my Live Id account for the ACS control panel is timber@example.com).

ServiceClient proxy = new ServiceClient("MyEndpoint");
proxy.ClientCredentials.UserName.UserName = "PineCreek";
proxy.ClientCredentials.UserName.Password = "badpassword";
proxy.DoMethod(); // this will throw FaultException: authN failed

As shown, the the wrong password was entered. The user name and password used here is the same as the .NET Services solution name and password (which is also different than the Live ID used to log in to the Access Control Service control panel).

The fixed code is as follows:

ServiceClient proxy = new ServiceClient("MyEndpoint");
proxy.ClientCredentials.UserName.UserName = "PineCreek";
proxy.ClientCredentials.UserName.Password = "ValidPassword";
proxy.DoMethod(); // this will now succeed

(Again, this also shows that the Live Id account doesn’t get used in the code).

Note: the Access Control Service credential management page is at https://accesscontrol.ex.azure.microsoft.com/ManageAccount.aspx

For reference, the exception is as follows:
System.ServiceModel.FaultException was unhandled
Message="authN failed: 'PineCreek' of PasswordCredential (#6a4d0ffb-4c3b-1cd8-d284-11660ae4cb08)"
Source="mscorlib"
Action="https://www.w3.org/2005/08/addressing/soap/fault"
StackTrace:
Server stack trace:
at System.ServiceModel.Security.IssuanceTokenProviderBase`1.DoNegotiation(TimeSpan timeout)
at System.ServiceModel.Security.IssuanceTokenProviderBase`1.GetTokenCore(TimeSpan timeout)
at System.IdentityModel.Selectors.SecurityTokenProvider.GetToken(TimeSpan timeout)