microsoft / msstore-cli

Microsoft Store CLI
MIT License
80 stars 8 forks source link

Error while retrieving Organization #28

Closed oliverschwendener closed 7 months ago

oliverschwendener commented 7 months ago

I'm an individual app developer and I want to publish my app to the Microsoft Store. Apparently this is the only way to get my app signed and trusted by Microsoft without spending enormous amounts of money on code signing certificates. I signed up for the developer program with my personal Microsoft account and on the Partner portal I can see that I could start submitting apps but I want to use the msstore cli to publish my app from GitHub actions. To test it out I wanted to play around with the cli on my local machine. I installed the msstore cli as described here but after signing in it shows an error Error while retrieving Organization.. Am I doing something wrong?

azchohfi commented 7 months ago

Could you run the command with -v? This should give you verbose logs and more details into the issue.

oliverschwendener commented 7 months ago

This is the error that I get when I run msstore reconfigure:

09:38:16 fail: MSStore.CLI.Services.CLIConfigurator[0] Error while retrieving Organization
MSAL.NetCore.4.59.0.0.MsalServiceException:
        ErrorCode: WAM_provider_error_2156265475
Microsoft.Identity.Client.MsalServiceException: WAM Error
 Error Code: 2156265475
 Error Message: ApiContractViolation
 WAM Error Message: (pii)
 Internal Error Code: 557973634
 Possible causes:
- Invalid redirect uri - ensure you have configured the following url in the application registration in Azure Portal:
ms-appx-web://microsoft.aad.brokerplugin/76b1a1a3-44ef-4bb8-bbe3-cb462ebaeee4
    at Microsoft.Identity.Client.Platforms.Features.RuntimeBroker.WamAdapters.HandleResponse(AuthResult authResult,
AuthenticationRequestParameters authenticationRequestParameters, ILoggerAdapter logger, String errorMessage)    at
Microsoft.Identity.Client.Platforms.Features.RuntimeBroker.RuntimeBroker.SignInInteractivelyAsync(AuthenticationRequestParameters authenticationRequestParameters, AcquireTokenInteractiveParameters acquireTokenInteractiveParameters)    at
Microsoft.Identity.Client.Platforms.Features.RuntimeBroker.RuntimeBroker.AcquireTokenInteractiveAsync(AuthenticationRequestParameters authenticationRequestParameters, AcquireTokenInteractiveParameters acquireTokenInteractiveParameters)
at Microsoft.Identity.Client.Internal.Broker.BrokerInteractiveRequestComponent.FetchTokensAsync(CancellationToken
cancellationToken)    at
Microsoft.Identity.Client.Internal.Requests.InteractiveRequest.FetchTokensFromBrokerAsync(String brokerInstallUrl,
CancellationToken cancellationToken)    at
Microsoft.Identity.Client.Internal.Requests.InteractiveRequest.GetTokenResponseAsync(CancellationToken
cancellationToken)    at Microsoft.Identity.Client.Internal.Requests.InteractiveRequest.ExecuteAsync(CancellationToken
cancellationToken)    at Microsoft.Identity.Client.Internal.Requests.RequestBase.RunAsync(CancellationToken
cancellationToken)    at
Microsoft.Identity.Client.ApiConfig.Executors.PublicClientExecutor.ExecuteAsync(AcquireTokenCommonParameters
commonParameters, AcquireTokenInteractiveParameters interactiveParameters, CancellationToken cancellationToken)    at
MSStore.CLI.Services.TokenManager.MSALTokenManager.GetTokenAsync(String[] scopes, CancellationToken ct) in
/_/MSStore.CLI/Services/TokenManager/MSALTokenManager.cs:line 99    at
MSStore.CLI.Services.CLIConfigurator.<>c__DisplayClass14_0.<<GetSignedInOrganizationAsync>b__0>d.MoveNext() in
/_/MSStore.CLI/Services/CLIConfigurator.cs:line 481
        StatusCode: 0
        ResponseBody:
        Headers:
💥 Error while retrieving Organization.
09:38:17 info: Microsoft.Hosting.Lifetime[0] Application is shutting down...
azchohfi commented 7 months ago

It seems like you are using an account that is an MSA. You can't use your MSA. Our docs mention this: https://learn.microsoft.com/en-us/windows/apps/publish/msstore-dev-cli/overview#prerequisites

Have a tenant associated with your Partner Center account. You can achieve that by either associating an existing Azure AD in Partner Center or by creating a new Azure AD in Partner Center.

Then, when signing in the CLI, you will be using that domain's account, not your MSA. Usually it is something like *.onmicrosoft.com.

Feel free to reopen the issue if that is not the case.

oliverschwendener commented 7 months ago

Thanks for your help. I was able to get further, now it fails to authenticate when setting the seller id. Could you help me with that?

image

I copied the seller id from https://partner.microsoft.com/en-us/dashboard/account/v3/organization/legalinfo#developer

image
azchohfi commented 7 months ago

Did you follow the steps that are asked before? You need to give the correct Entra App Manager permissions.

oliverschwendener commented 7 months ago

Yes, I did.

azchohfi commented 7 months ago

Do you get any extra information if you run it in verbose mode? Every time you run it, it will create a new app that you have to give permissions again on Partner Center (and you should delete the old ones if they are not being used).