azure - "Add-AzureAccount"出现错误 : Returned by service does not match user 'XXX' in the request

标签 azure active-directory azure-active-directory adfs azure-powershell

在 PowerShell 中运行“Add-AzureAccount”命令时出现错误: 服务返回的结果与请求中的用户“XXX”不匹配。

步骤: 打开PowerShell=>输入“Add-AzureAccount”=>弹出Microsoft登录UI=>输入我的AD电子邮件=>重定向到我的公司身份验证页面(ADFS)=>输入我的密码=>显示错误

Add-AzureAccount : User '<a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="5028282810333122223935227e2524337e333f3d" rel="noreferrer noopener nofollow">[email protected]</a>' returned by service does not match user '<a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="91e9e9e9e9e9e9d1c4c5d2d2d6ddbff2fefc" rel="noreferrer noopener nofollow">[email protected]</a>' in the request

At line:1 char:1
+ Add-AzureAccount
+ ~~~~~~~~~~~~~~~~
    + CategoryInfo          : CloseError: (:) [Add-AzureAccount], AadAuthenticationFailedException
    + FullyQualifiedErrorId : Microsoft.WindowsAzure.Commands.Profile.AddAzureAccount

Debug Log


DEBUG: 11:38:52 - AddAzureAccount begin processing with ParameterSet 'User'.
DEBUG: [Common.Authentication]: Authenticating using configuration values: Domain: 'Common', Endpoint: 'https://login.microsoftonline.
com/', ClientId: '**XXXXX**', ClientRedirect: 'urn:ietf:wg:oauth:2.0:oob', ResourceClientUri: 'https://mana
gement.core.windows.net/', ValidateAuthrity: 'True'
DEBUG: [Common.Authentication]: Acquiring token using context with Authority 'https://login.microsoftonline.com/Common/', CorrelationI
d: '00000000-0000-0000-0000-000000000000', ValidateAuthority: 'True'
DEBUG: [Common.Authentication]: Acquiring token using AdalConfiguration with Domain: 'Common', AdEndpoint: 'https://login.microsoftonl
ine.com/', ClientId: 'XXXXXX', ClientRedirectUri: urn:ietf:wg:oauth:2.0:oob
DEBUG: Microsoft.IdentityModel.Clients.ActiveDirectory Information: 2 : 
DEBUG: 07/02/2019 03:38:57: 901cc9d7-c601-4f0b-9558-6a83b7ceddf5 - AcquireTokenHandlerBase: === Token Acquisition started:
    Authority: https://login.microsoftonline.com/Common/
    Resource: https://management.core.windows.net/
    ClientId: XXXXX
    CacheType: Microsoft.Azure.Commands.Common.Authentication.AuthenticationStoreTokenCache (1 items)
    Authentication Target: User


DEBUG: Microsoft.IdentityModel.Clients.ActiveDirectory Verbose: 1 : 
DEBUG: 07/02/2019 03:38:57:  - WindowsFormsWebAuthenticationDialogBase: Navigating to 'https://login.microsoftonline.com/Common/oauth2
/authorize?resource=https://management.core.windows.net/&client_id=XXXXX&response_type=code&haschrome=1
&redirect_uri=urn:ietf:wg:oauth:2.0:oob&client-request-id=XXXXX&prompt=login&x-client-SKU=.NET&x-client
-Ver=2.28.3.860&x-client-CPU=x64&x-client-OS=Microsoft Windows NT 10.0.16299.0&site_id=501358&display=popup'.

DEBUG: Microsoft.IdentityModel.Clients.ActiveDirectory Verbose: 1 : 
DEBUG: 07/02/2019 03:38:57:  - WindowsFormsWebAuthenticationDialogBase: Navigating to 'https://login.microsoftonline.com/Common/oauth2
/authorize?resource=https://management.core.windows.net/&client_id=XXXXX&response_type=code&haschrome=1
&redirect_uri=urn:ietf:wg:oauth:2.0:oob&client-request-id=XXXXX&prompt=login&x-client-SKU=.NET&x-client
-Ver=2.28.3.860&x-client-CPU=x64&x-client-OS=Microsoft Windows NT 10.0.16299.0&site_id=501358&display=popup&sso_nonce=AQABAAAAAADCoMpj
JXrxTq9VG9te-7FX-DwzfR6rI_XrfZdXD670F6R5VHRu4Ff-09tO6L2hWujlpsWpl8LnubUat_G1yfX59vZx3UoEDDnq7HMPvfVjViAA&mscrid=901cc9d7-c601-4f0b-955
8-6a83b7ceddf5'.

DEBUG: Microsoft.IdentityModel.Clients.ActiveDirectory Verbose: 1 : 
DEBUG: 07/02/2019 03:38:58:  - WindowsFormsWebAuthenticationDialogBase: Navigated to 'https://login.microsoftonline.com/Common/oauth2/
authorize?resource=https://management.core.windows.net/&client_id=XXXXX&response_type=code&haschrome=1&
redirect_uri=urn:ietf:wg:oauth:2.0:oob&client-request-id=XXXXX&prompt=login&x-client-SKU=.NET&x-client-
Ver=2.28.3.860&x-client-CPU=x64&x-client-OS=Microsoft Windows NT 10.0.16299.0&site_id=501358&display=popup&sso_nonce=AQABAAAAAADCoMpjJ
XrxTq9VG9te-7FX-DwzfR6rI_XrfZdXD670F6R5VHRu4Ff-09tO6L2hWujlpsWpl8LnubUat_G1yfX59vZx3UoEDDnq7HMPvfVjViAA&mscrid=901cc9d7-c601-4f0b-9558
-6a83b7ceddf5'.

DEBUG: Microsoft.IdentityModel.Clients.ActiveDirectory Verbose: 1 : 
DEBUG: 07/02/2019 03:38:58:  - WindowsFormsWebAuthenticationDialogBase: Navigating to 'https://login.live.com/Me.htm?v=1'.

DEBUG: Microsoft.IdentityModel.Clients.ActiveDirectory Verbose: 1 : 
DEBUG: 07/02/2019 03:38:58:  - WindowsFormsWebAuthenticationDialogBase: Navigated to 'https://login.live.com/Me.htm?v=1'.

DEBUG: Microsoft.IdentityModel.Clients.ActiveDirectory Verbose: 1 : 
DEBUG: 07/02/2019 03:39:11:  - WindowsFormsWebAuthenticationDialogBase: Navigating to 'https://fsaz.utcapp.com/adfs/ls/?wfresh=0&wauth
=http://schemas.microsoft.com/ws/2008/06/identity/authenticationmethod/password&client-request-id=XXXXX
&<a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="fa8f899f88949b979fc7a2a2a2ba8f8e99999d96d4999597" rel="noreferrer noopener nofollow">[email protected]</a>&wa=wsignin1.0&wtrealm=urn:federation:MicrosoftOnline&wctx=LoginOptions=3&estsredirect=2&estsrequest=rQIIAePiM
tIzstAz1rMwMxBiNNRiNtQztFIxtDQ1SDQytdA1MjJP0jVJNTbUTbRMTtM1NzQ3sTS1NDFNSzbyYjM1MDQ2tSgS4hK4flJmAuMxbv-pEVnN28_d_TqJkbUgv6C0YBWjZGlRnlV
makmaVXm6VX5iaUmGlZGegVV-ftIORsYLjIwvGBlvMfH7OwIljEBEflFmVeorJtac_PTMvFXMKhklJQXFVvr6uYl5iempual5JXrJ-UWpeuWZeSn55cV6eakl-puY2ZLzc3Pz8
24wMz5i5isvrXAoLUlOTs8BKs29wML4ikWCg0lARoJZ4Q6bBosBsxUnB5cAg8TqegWGHyyMi1iBHuBYIbd7J9sL5xUdGz2qD0YwnGLVL09JDUgKTknMz6xMs6zQTsoIjSpMDfX
OTM01TsoJcvfwKi_11jd19_TTdrQ1tTKcwMZ4io1Fz8815AMbYwc7wy5O3F6_xSViZGBoqWtgrmtgpGBgbGVsaWVgEQUA0&cbcxt=&mkt=&lc='.

DEBUG: Microsoft.IdentityModel.Clients.ActiveDirectory Verbose: 1 : 
DEBUG: 07/02/2019 03:39:13:  - WindowsFormsWebAuthenticationDialogBase: Navigated to 'https://fsaz.utcapp.com/adfs/ls/?wfresh=0&wauth=
http://schemas.microsoft.com/ws/2008/06/identity/authenticationmethod/password&client-request-id=XXXXX
<a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="2a5f594f58444b474f177272726a5f5e49494d4604494547" rel="noreferrer noopener nofollow">[email protected]</a>&wa=wsignin1.0&wtrealm=urn:federation:MicrosoftOnline&wctx=LoginOptions=3&estsredirect=2&estsrequest=rQIIAePiMt
IzstAz1rMwMxBiNNRiNtQztFIxtDQ1SDQytdA1MjJP0jVJNTbUTbRMTtM1NzQ3sTS1NDFNSzbyYjM1MDQ2tSgS4hK4flJmAuMxbv-pEVnN28_d_TqJkbUgv6C0YBWjZGlRnlVm
akmaVXm6VX5iaUmGlZGegVV-ftIORsYLjIwvGBlvMfH7OwIljEBEflFmVeorJtac_PTMvFXMKhklJQXFVvr6uYl5iempual5JXrJ-UWpeuWZeSn55cV6eakl-puY2ZLzc3Pz82
4wMz5i5isvrXAoLUlOTs8BKs29wML4ikWCg0lARoJZ4Q6bBosBsxUnB5cAg8TqegWGHyyMi1iBHuBYIbd7J9sL5xUdGz2qD0YwnGLVL09JDUgKTknMz6xMs6zQTsoIjSpMDfXO
TM01TsoJcvfwKi_11jd19_TTdrQ1tTKcwMZ4io1Fz8815AMbYwc7wy5O3F6_xSViZGBoqWtgrmtgpGBgbGVsaWVgEQUA0&cbcxt=&mkt=&lc='.

DEBUG: Microsoft.IdentityModel.Clients.ActiveDirectory Verbose: 1 : 
DEBUG: 07/02/2019 03:41:27:  - WindowsFormsWebAuthenticationDialogBase: Navigating to 'https://fsaz.utcapp.com/adfs/ls/?wfresh=0&wauth
=http://schemas.microsoft.com/ws/2008/06/identity/authenticationmethod/password&client-request-id=XXXXX
&<a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="9aefe9ffe8f4fbf7ffa7c2c2c2daefeef9f9fdf6b4f9f5f7" rel="noreferrer noopener nofollow">[email protected]</a>&wa=wsignin1.0&wtrealm=urn:federation:MicrosoftOnline&wctx=LoginOptions=3&estsredirect=2&estsrequest=rQIIAePiM
tIzstAz1rMwMxBiNNRiNtQztFIxtDQ1SDQytdA1MjJP0jVJNTbUTbRMTtM1NzQ3sTS1NDFNSzbyYjM1MDQ2tSgS4hK4flJmAuMxbv-pEVnN28_d_TqJkbUgv6C0YBWjZGlRnlV
makmaVXm6VX5iaUmGlZGegVV-ftIORsYLjIwvGBlvMfH7OwIljEBEflFmVeorJtac_PTMvFXMKhklJQXFVvr6uYl5iempual5JXrJ-UWpeuWZeSn55cV6eakl-puY2ZLzc3Pz8
24wMz5i5isvrXAoLUlOTs8BKs29wML4ikWCg0lARoJZ4Q6bBosBsxUnB5cAg8TqegWGHyyMi1iBHuBYIbd7J9sL5xUdGz2qD0YwnGLVL09JDUgKTknMz6xMs6zQTsoIjSpMDfX
OTM01TsoJcvfwKi_11jd19_TTdrQ1tTKcwMZ4io1Fz8815AMbYwc7wy5O3F6_xSViZGBoqWtgrmtgpGBgbGVsaWVgEQUA0&cbcxt=&mkt=&lc='.

DEBUG: Microsoft.IdentityModel.Clients.ActiveDirectory Verbose: 1 : 
DEBUG: 07/02/2019 03:41:29:  - WindowsFormsWebAuthenticationDialogBase: Navigating to 'https://fsaz.utcapp.com/adfs/ls/?wfresh=0&wauth
=http://schemas.microsoft.com/ws/2008/06/identity/authenticationmethod/password&client-request-id=XXXXX
&<a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="73060016011d121e164e2b2b2b3306071010141f5d101c1e" rel="noreferrer noopener nofollow">[email protected]</a>&wa=wsignin1.0&wtrealm=urn:federation:MicrosoftOnline&wctx=LoginOptions=3&estsredirect=2&estsrequest=rQIIAePiM
tIzstAz1rMwMxBiNNRiNtQztFIxtDQ1SDQytdA1MjJP0jVJNTbUTbRMTtM1NzQ3sTS1NDFNSzbyYjM1MDQ2tSgS4hK4flJmAuMxbv-pEVnN28_d_TqJkbUgv6C0YBWjZGlRnlV
makmaVXm6VX5iaUmGlZGegVV-ftIORsYLjIwvGBlvMfH7OwIljEBEflFmVeorJtac_PTMvFXMKhklJQXFVvr6uYl5iempual5JXrJ-UWpeuWZeSn55cV6eakl-puY2ZLzc3Pz8
24wMz5i5isvrXAoLUlOTs8BKs29wML4ikWCg0lARoJZ4Q6bBosBsxUnB5cAg8TqegWGHyyMi1iBHuBYIbd7J9sL5xUdGz2qD0YwnGLVL09JDUgKTknMz6xMs6zQTsoIjSpMDfX
OTM01TsoJcvfwKi_11jd19_TTdrQ1tTKcwMZ4io1Fz8815AMbYwc7wy5O3F6_xSViZGBoqWtgrmtgpGBgbGVsaWVgEQUA0&cbcxt=&mkt=&lc='.

DEBUG: Microsoft.IdentityModel.Clients.ActiveDirectory Verbose: 1 : 
DEBUG: 07/02/2019 03:41:31:  - WindowsFormsWebAuthenticationDialogBase: Navigating to 'https://fsaz.utcapp.com/adfs/ls/?wfresh=0&wauth
=http://schemas.microsoft.com/ws/2008/06/identity/authenticationmethod/password&client-request-id=XXXXX
&<a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="a9dcdaccdbc7c8c4cc94f1f1f1e9dcddcacacec587cac6c4" rel="noreferrer noopener nofollow">[email protected]</a>&wa=wsignin1.0&wtrealm=urn:federation:MicrosoftOnline&wctx=LoginOptions=3&estsredirect=2&estsrequest=rQIIAePiM
tIzstAz1rMwMxBiNNRiNtQztFIxtDQ1SDQytdA1MjJP0jVJNTbUTbRMTtM1NzQ3sTS1NDFNSzbyYjM1MDQ2tSgS4hK4flJmAuMxbv-pEVnN28_d_TqJkbUgv6C0YBWjZGlRnlV
makmaVXm6VX5iaUmGlZGegVV-ftIORsYLjIwvGBlvMfH7OwIljEBEflFmVeorJtac_PTMvFXMKhklJQXFVvr6uYl5iempual5JXrJ-UWpeuWZeSn55cV6eakl-puY2ZLzc3Pz8
24wMz5i5isvrXAoLUlOTs8BKs29wML4ikWCg0lARoJZ4Q6bBosBsxUnB5cAg8TqegWGHyyMi1iBHuBYIbd7J9sL5xUdGz2qD0YwnGLVL09JDUgKTknMz6xMs6zQTsoIjSpMDfX
OTM01TsoJcvfwKi_11jd19_TTdrQ1tTKcwMZ4io1Fz8815AMbYwc7wy5O3F6_xSViZGBoqWtgrmtgpGBgbGVsaWVgEQUA0&cbcxt=&mkt=&lc=&ssoCookie=0d5c1e40-8d5b
-46eb-854e-e14c815542f5'.

DEBUG: Microsoft.IdentityModel.Clients.ActiveDirectory Verbose: 1 : 
DEBUG: 07/02/2019 03:41:32:  - WindowsFormsWebAuthenticationDialogBase: Navigated to 'https://fsaz.utcapp.com/adfs/ls/?wfresh=0&wauth=
http://schemas.microsoft.com/ws/2008/06/identity/authenticationmethod/password&client-request-id=XXXXX
<a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="62171107100c030f075f3a3a3a2217160101050e4c010d0f" rel="noreferrer noopener nofollow">[email protected]</a>&wa=wsignin1.0&wtrealm=urn:federation:MicrosoftOnline&wctx=LoginOptions=3&estsredirect=2&estsrequest=rQIIAePiMt
IzstAz1rMwMxBiNNRiNtQztFIxtDQ1SDQytdA1MjJP0jVJNTbUTbRMTtM1NzQ3sTS1NDFNSzbyYjM1MDQ2tSgS4hK4flJmAuMxbv-pEVnN28_d_TqJkbUgv6C0YBWjZGlRnlVm
akmaVXm6VX5iaUmGlZGegVV-ftIORsYLjIwvGBlvMfH7OwIljEBEflFmVeorJtac_PTMvFXMKhklJQXFVvr6uYl5iempual5JXrJ-UWpeuWZeSn55cV6eakl-puY2ZLzc3Pz82
4wMz5i5isvrXAoLUlOTs8BKs29wML4ikWCg0lARoJZ4Q6bBosBsxUnB5cAg8TqegWGHyyMi1iBHuBYIbd7J9sL5xUdGz2qD0YwnGLVL09JDUgKTknMz6xMs6zQTsoIjSpMDfXO
TM01TsoJcvfwKi_11jd19_TTdrQ1tTKcwMZ4io1Fz8815AMbYwc7wy5O3F6_xSViZGBoqWtgrmtgpGBgbGVsaWVgEQUA0&cbcxt=&mkt=&lc=&ssoCookie=0d5c1e40-8d5b-
46eb-854e-e14c815542f5'.

DEBUG: Microsoft.IdentityModel.Clients.ActiveDirectory Verbose: 1 : 
DEBUG: 07/02/2019 03:41:32:  - WindowsFormsWebAuthenticationDialogBase: Navigating to 'https://login.microsoftonline.com/login.srf?cli
ent-request-id=XXXXX'.

DEBUG: Microsoft.IdentityModel.Clients.ActiveDirectory Verbose: 1 : 
DEBUG: 07/02/2019 03:41:33:  - WindowsFormsWebAuthenticationDialogBase: WebBrowser state: IsBusy: True, ReadyState: Complete, Created:
 True, Disposing: False, IsDisposed: False, IsOffline: False

DEBUG: Microsoft.IdentityModel.Clients.ActiveDirectory Verbose: 1 : 
DEBUG: 07/02/2019 03:41:33:  - WindowsFormsWebAuthenticationDialogBase: WebBrowser state (after Stop): IsBusy: False, ReadyState: Comp
lete, Created: True, Disposing: False, IsDisposed: False, IsOffline: False

DEBUG: Microsoft.IdentityModel.Clients.ActiveDirectory Verbose: 1 : 
DEBUG: 07/02/2019 03:41:34: XXXXX - TokenCache: Storing token in the cache...

DEBUG: Microsoft.IdentityModel.Clients.ActiveDirectory Verbose: 1 : 
DEBUG: 07/02/2019 03:41:34: XXXXX - TokenCache: An item was stored in the cache

DEBUG: Microsoft.IdentityModel.Clients.ActiveDirectory Information: 2 : 
DEBUG: 07/02/2019 03:41:34: XXXXX - AcquireTokenHandlerBase: === Token Acquisition finished successfull
y. An access token was retuned:
    Access Token Hash: XXXXX
    Refresh Token Hash: U80lp4/LTmBKc3Xh5hYpWpdfaTe2hbxSxvtD4PDMVqk=
    Expiration Time: 07/02/2019 04:41:34 +00:00
    User Hash: XXXXX


DEBUG: Microsoft.IdentityModel.Clients.ActiveDirectory Information: 2 : 
DEBUG: 07/02/2019 03:41:34:  - TokenCache: Serializing token cache with 1 items.

DEBUG: ============================ HTTP REQUEST ============================

HTTP Method:
GET

Absolute Uri:
https://management.core.windows.net/subscriptions

Headers:
x-ms-version                  : 2013-08-01

Body:



DEBUG: ============================ HTTP RESPONSE ============================

Status Code:
OK

Headers:
x-ms-servedbyregion           : ussouth3
x-ms-request-id               : d1d99bf68fc0aa77953c90dc85c56894
Cache-Control                 : no-cache
Date                          : Tue, 02 Jul 2019 03:41:35 GMT
Server                        : 67.3.0.175/release1,(c937119),Microsoft-HTTPAPI/2.0

Body:
<Subscriptions xmlns="http://schemas.microsoft.com/windowsazure" xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
  <Subscription>
    <SubscriptionID>XXXX</SubscriptionID>
    <SubscriptionName>XXXX</SubscriptionName>
    <SubscriptionStatus>Active</SubscriptionStatus>
    <AccountAdminLiveEmailId><a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="28707070707068475d5c44474743064b4745" rel="noreferrer noopener nofollow">[email protected]</a></AccountAdminLiveEmailId>
    <ServiceAdminLiveEmailId><a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="f1a9a9a9a9a9b19e84859d9e9e9adf929e9c" rel="noreferrer noopener nofollow">[email protected]</a></ServiceAdminLiveEmailId>
    <MaxCoreCount>350</MaxCoreCount>
    <MaxStorageAccounts>100</MaxStorageAccounts>
    <MaxHostedServices>20</MaxHostedServices>
    <CurrentCoreCount>0</CurrentCoreCount>
    <CurrentHostedServices>0</CurrentHostedServices>
    <CurrentStorageAccounts>0</CurrentStorageAccounts>
    <MaxVirtualNetworkSites>100</MaxVirtualNetworkSites>
    <MaxLocalNetworkSites>20</MaxLocalNetworkSites>
    <MaxDnsServers>20</MaxDnsServers>
    <OfferCategories>Azure_Platform_All;Azure_Paid;Azure_Consumption;Azure_EA;Azure_MS-AZR-0017P;Individual</OfferCategories>
    <MaxExtraVIPCount>-1</MaxExtraVIPCount>
    <AADTenantID>XXXXX</AADTenantID>
    <CreatedTime>2018-09-27T06:41:39Z</CreatedTime>
  </Subscription>
  <Subscription>
    <SubscriptionID>XXXXX</SubscriptionID>
    <SubscriptionName>XXX</SubscriptionName>
    <SubscriptionStatus>Active</SubscriptionStatus>
    <AccountAdminLiveEmailId><a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="d98181818199b6acadb5b6b6b2f7bab6b4" rel="noreferrer noopener nofollow">[email protected]</a></AccountAdminLiveEmailId>
    <ServiceAdminLiveEmailId><a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="a1f9f9f9f9f9e1ced4d5cdcececa8fc2cecc" rel="noreferrer noopener nofollow">[email protected]</a></ServiceAdminLiveEmailId>
    <MaxCoreCount>350</MaxCoreCount>
    <MaxStorageAccounts>100</MaxStorageAccounts>
    <MaxHostedServices>20</MaxHostedServices>
    <CurrentCoreCount>0</CurrentCoreCount>
    <CurrentHostedServices>0</CurrentHostedServices>
    <CurrentStorageAccounts>0</CurrentStorageAccounts>
    <MaxVirtualNetworkSites>100</MaxVirtualNetworkSites>
    <MaxLocalNetworkSites>20</MaxLocalNetworkSites>
    <MaxDnsServers>20</MaxDnsServers>
    <OfferCategories>Azure_Platform_All;Azure_Paid;Azure_Consumption;Azure_EA;Azure_MS-AZR-0017P;Individual</OfferCategories>
    <MaxExtraVIPCount>-1</MaxExtraVIPCount>
    <AADTenantID>XXXXX</AADTenantID>
    <CreatedTime>2018-11-12T01:32:21Z</CreatedTime>
  </Subscription>
  <Subscription>
    <SubscriptionID>XXXXX</SubscriptionID>
    <SubscriptionName>XXXX</SubscriptionName>
    <SubscriptionStatus>Active</SubscriptionStatus>
    <AccountAdminLiveEmailId><a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="643c3c3c3c240b1110080b0b0f4a070b09" rel="noreferrer noopener nofollow">[email protected]</a></AccountAdminLiveEmailId>
    <ServiceAdminLiveEmailId><a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="4e161616160e213b3a22212125602d2123" rel="noreferrer noopener nofollow">[email protected]</a></ServiceAdminLiveEmailId>
    <MaxCoreCount>350</MaxCoreCount>
    <MaxStorageAccounts>100</MaxStorageAccounts>
    <MaxHostedServices>20</MaxHostedServices>
    <CurrentCoreCount>0</CurrentCoreCount>
    <CurrentHostedServices>0</CurrentHostedServices>
    <CurrentStorageAccounts>0</CurrentStorageAccounts>
    <MaxVirtualNetworkSites>100</MaxVirtualNetworkSites>
    <MaxLocalNetworkSites>20</MaxLocalNetworkSites>
    <MaxDnsServers>20</MaxDnsServers>
    <OfferCategories>Azure_Platform_All;Azure_Paid;Azure_Consumption;Azure_EA;Azure_MS-AZR-0017P;Individual</OfferCategories>
    <MaxExtraVIPCount>-1</MaxExtraVIPCount>
    <AADTenantID>XXXXX</AADTenantID>
    <CreatedTime>2018-08-28T02:42:13Z</CreatedTime>
  </Subscription>
  <Subscription>
    <SubscriptionID>XXXX</SubscriptionID>
    <SubscriptionName>XXXXX</SubscriptionName>
    <SubscriptionStatus>Active</SubscriptionStatus>
    <AccountAdminLiveEmailId><a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="7e2626263e2b2a3d3d3932501d1113" rel="noreferrer noopener nofollow">[email protected]</a></AccountAdminLiveEmailId>
    <ServiceAdminLiveEmailId><a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="5e0606061e0b0a1d1d1912703d3133" rel="noreferrer noopener nofollow">[email protected]</a></ServiceAdminLiveEmailId>
    <MaxCoreCount>350</MaxCoreCount>
    <MaxStorageAccounts>100</MaxStorageAccounts>
    <MaxHostedServices>20</MaxHostedServices>
    <CurrentCoreCount>0</CurrentCoreCount>
    <CurrentHostedServices>0</CurrentHostedServices>
    <CurrentStorageAccounts>0</CurrentStorageAccounts>
    <MaxVirtualNetworkSites>100</MaxVirtualNetworkSites>
    <MaxLocalNetworkSites>20</MaxLocalNetworkSites>
    <MaxDnsServers>20</MaxDnsServers>
    <OfferCategories>Azure_Platform_All;Azure_Paid;Azure_Consumption;Azure_EA;Azure_MS-AZR-0017P;Individual</OfferCategories>
    <MaxExtraVIPCount>-1</MaxExtraVIPCount>
    <AADTenantID>XXXXXXXXX</AADTenantID>
    <CreatedTime>2019-05-13T02:58:34Z</CreatedTime>
  </Subscription>
</Subscriptions>


DEBUG: [Common.Authentication]: Authenticating using configuration values: Domain: 'XXXXX', Endpoint: '
https://login.microsoftonline.com/', ClientId: 'XXXX', ClientRedirect: 'urn:ietf:wg:oauth:2.0:oob', Re
sourceClientUri: 'https://management.core.windows.net/', ValidateAuthrity: 'True'
DEBUG: [Common.Authentication]: Acquiring token using context with Authority 'https://login.microsoftonline.com/f4841380-e7f4-4f8b-9d3
f-525914ae311d/', CorrelationId: '00000000-0000-0000-0000-000000000000', ValidateAuthority: 'True'
DEBUG: [Common.Authentication]: Acquiring token using AdalConfiguration with Domain: 'f4841380-e7f4-4f8b-9d3f-525914ae311d', AdEndpoin
t: 'https://login.microsoftonline.com/', ClientId: '1950a258-227b-4e31-a9cf-717495945fc2', ClientRedirectUri: urn:ietf:wg:oauth:2.0:oo
b
DEBUG: Microsoft.IdentityModel.Clients.ActiveDirectory Information: 2 : 
DEBUG: 07/02/2019 03:41:36: ddba4a62-c19a-462d-bdda-174ad69a7b7a - AcquireTokenHandlerBase: === Token Acquisition started:
    Authority: https://login.microsoftonline.com/f4841380-e7f4-4f8b-9d3f-525914ae311d/
    Resource: https://management.core.windows.net/
    ClientId: XXXXX
    CacheType: Microsoft.Azure.Commands.Common.Authentication.AuthenticationStoreTokenCache (1 items)
    Authentication Target: User


DEBUG: Microsoft.IdentityModel.Clients.ActiveDirectory Verbose: 1 : 
DEBUG: 07/02/2019 03:41:36: XXXX - TokenCache: Looking up cache for a token...

DEBUG: Microsoft.IdentityModel.Clients.ActiveDirectory Information: 2 : 
DEBUG: 07/02/2019 03:41:36: XXXXX - TokenCache: No matching token was found in the cache

DEBUG: Microsoft.IdentityModel.Clients.ActiveDirectory Verbose: 1 : 
DEBUG: 07/02/2019 03:41:36:  - WindowsFormsWebAuthenticationDialogBase: Navigating to 'https://login.microsoftonline.com/f4841380-e7f4
-4f8b-9d3f-525914ae311d/oauth2/authorize?resource=https://management.core.windows.net/&client_id=XXXX
response_type=code&haschrome=1&redirect_uri=urn:ietf:wg:oauth:2.0:oob&<a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="3854575f5156675051564c056f6d60786d6c7b7b7f74165b5755" rel="noreferrer noopener nofollow">[email protected]</a>&client-request-id=XXXXX&prompt=attempt_none&x-client-SKU=.NET&x-client-Ver=2.28.3.860&x-client-CPU=x64&x-client-OS=Microsoft Windows NT 10.0.
16299.0&site_id=501358&display=popup'.

DEBUG: Microsoft.IdentityModel.Clients.ActiveDirectory Verbose: 1 : 
DEBUG: 07/02/2019 03:41:37:  - WindowsFormsWebAuthenticationDialogBase: Navigating to 'https://login.microsoftonline.com/XXXX/oauth2/authorize?resource=https://management.core.windows.net/&client_id=XXXXX
response_type=code&haschrome=1&redirect_uri=urn:ietf:wg:oauth:2.0:oob&<a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="6d01020a04033205040319503535352d38392e2e2a21430e0200" rel="noreferrer noopener nofollow">[email protected]</a>&client-request-id=XXXXX&prompt=attempt_none&x-client-SKU=.NET&x-client-Ver=2.28.3.860&x-client-CPU=x64&x-client-OS=Microsoft Windows NT 10.0.
16299.0&site_id=501358&display=popup&sso_nonce=AQABAAAAAADCoMpjJXrxTq9VG9te-7FXACiy4PAt-bgXL2BHSIuPj0VUe1VyjXdxXb8cpsLvAGzOmy1o8kJ0QfZ
OH1zopd9MgnCPQkOVELD4N_ndC8w4vCAA&mscrid=ddba4a62-c19a-462d-bdda-174ad69a7b7a'.

DEBUG: Microsoft.IdentityModel.Clients.ActiveDirectory Error: 4 : 
DEBUG: 07/02/2019 03:41:39:XXXXX - <RunAsync>d__0: Microsoft.IdentityModel.Clients.ActiveDirectory.Ada
lUserMismatchException: User '<a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="297171717171694a485b5b404c5b075c5d4a074a4644" rel="noreferrer noopener nofollow">[email protected]</a>' returned by service does not match user '<a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="134b4b4b5346475050545f3d707c7e" rel="noreferrer noopener nofollow">[email protected]</a>' in the request
   at Microsoft.IdentityModel.Clients.ActiveDirectory.AcquireTokenInteractiveHandler.PostTokenRequest(AuthenticationResult result)
   at Microsoft.IdentityModel.Clients.ActiveDirectory.AcquireTokenHandlerBase.<RunAsync>d__0.MoveNext()
    ErrorCode: user_mismatch
    RequestedUser: <a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="d8808080988d8c9b9b9f94f6bbb7b5" rel="noreferrer noopener nofollow">[email protected]</a>
    ReturnedUser: <a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="8ed6d6d6d6d6ceedeffcfce7ebfca0fbfaeda0ede1e3" rel="noreferrer noopener nofollow">[email protected]</a>

DEBUG: Microsoft.IdentityModel.Clients.ActiveDirectory Information: 2 : 
DEBUG: 07/02/2019 03:41:39:  - TokenCache: Serializing token cache with 1 items.

Add-AzureAccount : User '<a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="0d55555555554d6e6c7f7f64687f2378796e236e6260" rel="noreferrer noopener nofollow">[email protected]</a>' returned by service does not match user '<a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="0c5454544c59584f4f4b40226f6361" rel="noreferrer noopener nofollow">[email protected]</a>' in the request
At line:1 char:1
+ Add-AzureAccount -Debug
+ ~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : CloseError: (:) [Add-AzureAccount], AadAuthenticationFailedException
    + FullyQualifiedErrorId : Microsoft.WindowsAzure.Commands.Profile.AddAzureAccount

DEBUG: AzureQoSEvent: CommandName - Add-AzureAccount; IsSuccess - False; Duration - 00:02:50.2749847; Exception - Microsoft.Azure.Comm
ands.Common.Authentication.AadAuthenticationFailedException: User '<a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="df87878787879fbcbeadadb6baadf1aaabbcf1bcb0b2" rel="noreferrer noopener nofollow">[email protected]</a>' returned by service does not match user 'XX
<a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="3961796c6d7a7a7e75175a5654" rel="noreferrer noopener nofollow">[email protected]</a>' in the request ---> Microsoft.IdentityModel.Clients.ActiveDirectory.AdalUserMismatchException: User '<a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="683030303030280b091a1a010d1a461d1c0b" rel="noreferrer noopener nofollow">[email protected]</a>.
com' returned by service does not match user '<a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="bfe7e7e7ffeaebfcfcf8f391dcd0d2" rel="noreferrer noopener nofollow">[email protected]</a>' in the request
   at Microsoft.IdentityModel.Clients.ActiveDirectory.AuthenticationContext.RunAsyncTask[T](Task`1 task)
   at Microsoft.Azure.Commands.Common.Authentication.UserTokenProvider.DoAcquireToken(AdalConfiguration config, PromptBehavior promptB
ehavior, Action`1 promptAction, String userId, SecureString password)
   at Microsoft.Azure.Commands.Common.Authentication.UserTokenProvider.SafeAquireToken(AdalConfiguration config, String showDialog, Ac
tion`1 promptAction, String userId, SecureString password, Exception& ex)
   --- End of inner exception stack trace ---
   at Microsoft.Azure.ServiceManagemenet.Common.ProfileClient.WriteOrThrowAadExceptionMessage(AadAuthenticationException aadEx)
   at Microsoft.Azure.ServiceManagemenet.Common.ProfileClient.ListSubscriptionsFromServer(IAzureAccount account, IAzureEnvironment env
ironment, SecureString password, String promptBehavior, Action`1 promptAction)
   at Microsoft.Azure.ServiceManagemenet.Common.ProfileClient.AddAccountAndLoadSubscriptions(IAzureAccount account, IAzureEnvironment 
environment, SecureString password)
   at Microsoft.WindowsAzure.Commands.Profile.AddAzureAccount.ExecuteCmdlet()
   at Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet.ProcessRecord();
DEBUG: Finish sending metric.
DEBUG: 11:41:43 - AddAzureAccount end processing.
DEBUG: 11:41:43 - AddAzureAccount end processing.

最佳答案

尝试使用 powershell 版本 5.1.14393.1198 重现相同的问题,并且能够重现它。

我能够通过首先使用 Remove-AzureAccount 删除帐户,然后再次添加帐户并使用“* 选择个人帐户来解决此问题*Add-AzureAccount**”命令。

请尝试看看是否有帮助。如果仍然不起作用,请告诉我并提供详细的详细日志,将能够为您提供进一步的帮助。

关于azure - "Add-AzureAccount"出现错误 : Returned by service does not match user 'XXX' in the request,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56831091/

相关文章:

sql-server - 如何使用 GUID 从 SQL Server 表引用 Azure 表数据

ssl - 当父域是非 SSL 时如何使用 LDAPS 创建子域?

spring - 使用 Spring LdapTemplate 从 Active Directory 获取所有属性

.net - 如何将 Servicestack 身份验证与 Active Directory/Windows 身份验证一起使用?

azure - 从逻辑应用中变量的内容创建 blob

azure - 如何远程桌面到Azure App?

architecture - 使用 Azure 存储表作为队列并由多个辅助角色处理?

Azure,使用一封电子邮件登录单独的帐户

azure - Terraform "AuthorizationFailed"与 Azure 提供商

azure - 为什么我在尝试连接 Azure Aql 服务器时只启用了 Azure Active Directory 身份验证?