Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

More messages for common Store package download scenarios #4841

Merged
merged 6 commits into from
Oct 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions doc/windows/package-manager/winget/returnCodes.md
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,8 @@ ms.localizationpriority: medium
| 0x8A150081 | -1978335103 | APPINSTALLER_CLI_ERROR_SFSCLIENT_API_FAILED | Failed to get Microsoft Store package download information. |
| 0x8A150082 | -1978335102 | APPINSTALLER_CLI_ERROR_NO_APPLICABLE_SFSCLIENT_PACKAGE | No applicable Microsoft Store package download information found. |
| 0x8A150083 | -1978335101 | APPINSTALLER_CLI_ERROR_LICENSING_API_FAILED | Failed to retrieve Microsoft Store package license. |
| 0x8A150084 | -1978335100 | APPINSTALLER_CLI_ERROR_SFSCLIENT_PACKAGE_NOT_SUPPORTED | The Microsoft Store package does not support download command. |
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
| 0x8A150084 | -1978335100 | APPINSTALLER_CLI_ERROR_SFSCLIENT_PACKAGE_NOT_SUPPORTED | The Microsoft Store package does not support download command. |
| 0x8A150084 | -1978335100 | APPINSTALLER_CLI_ERROR_SFSCLIENT_PACKAGE_NOT_SUPPORTED | The Microsoft Store package does not support download. |

| 0x8A150085 | -1978335099 | APPINSTALLER_CLI_ERROR_LICENSING_API_FAILED_FORBIDDEN | Failed to retrieve Microsoft Store package license. The Microsoft Entra Id account does not have required privilege. |
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
| 0x8A150085 | -1978335099 | APPINSTALLER_CLI_ERROR_LICENSING_API_FAILED_FORBIDDEN | Failed to retrieve Microsoft Store package license. The Microsoft Entra Id account does not have required privilege. |
| 0x8A150085 | -1978335099 | APPINSTALLER_CLI_ERROR_LICENSING_API_FAILED_FORBIDDEN | Failed to retrieve Microsoft Store package license. The Microsoft Entra Id account does not have the required privilege. |


## Install errors.

Expand Down
5 changes: 4 additions & 1 deletion src/AppInstallerCLICore/Resources.h
Original file line number Diff line number Diff line change
Expand Up @@ -370,14 +370,17 @@ namespace AppInstaller::CLI::Resource
WINGET_DEFINE_RESOURCE_STRINGID(MSStoreDownloadGetDownloadInfoFailed);
WINGET_DEFINE_RESOURCE_STRINGID(MSStoreDownloadGetLicense);
WINGET_DEFINE_RESOURCE_STRINGID(MSStoreDownloadGetLicenseFailed);
WINGET_DEFINE_RESOURCE_STRINGID(MSStoreDownloadGetLicenseForbidden);
WINGET_DEFINE_RESOURCE_STRINGID(MSStoreDownloadGetLicenseSuccess);
WINGET_DEFINE_RESOURCE_STRINGID(MSStoreDownloadMainPackages);
WINGET_DEFINE_RESOURCE_STRINGID(MSStoreDownloadMultiplePackagesNotice);
WINGET_DEFINE_RESOURCE_STRINGID(MSStoreDownloadNoApplicablePackageFound);
WINGET_DEFINE_RESOURCE_STRINGID(MSStoreDownloadPackageDownloaded);
WINGET_DEFINE_RESOURCE_STRINGID(MSStoreDownloadPackageDownloadFailed);
WINGET_DEFINE_RESOURCE_STRINGID(MSStoreDownloadPackageDownloadNotSupported);
WINGET_DEFINE_RESOURCE_STRINGID(MSStoreDownloadPackageDownloadSuccess);
WINGET_DEFINE_RESOURCE_STRINGID(MSStoreDownloadPackageHashMismatch);
WINGET_DEFINE_RESOURCE_STRINGID(MSStoreDownloadPackageHashVerified);
WINGET_DEFINE_RESOURCE_STRINGID(MSStoreDownloadPackageNotFound);
WINGET_DEFINE_RESOURCE_STRINGID(MSStoreDownloadRenameNotSupported);
WINGET_DEFINE_RESOURCE_STRINGID(MSStoreInstallOrUpdateFailed);
WINGET_DEFINE_RESOURCE_STRINGID(MSStoreInstallTryGetEntitlement);
Expand Down
23 changes: 18 additions & 5 deletions src/AppInstallerCLICore/Workflows/MSStoreInstallerHandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -271,6 +271,7 @@ namespace AppInstaller::CLI::Workflow

// Authentication notice
context.Reporter.Warn() << Resource::String::MSStoreDownloadAuthenticationNotice << std::endl;
context.Reporter.Warn() << Resource::String::MSStoreDownloadMultiplePackagesNotice << std::endl;

const auto& installer = context.Get<Execution::Data::Installer>().value();

Expand Down Expand Up @@ -307,13 +308,16 @@ namespace AppInstaller::CLI::Workflow
{
case APPINSTALLER_CLI_ERROR_NO_APPLICABLE_DISPLAYCATALOG_PACKAGE:
case APPINSTALLER_CLI_ERROR_NO_APPLICABLE_SFSCLIENT_PACKAGE:
context.Reporter.Error() << Resource::String::MSStoreDownloadPackageNotFound << std::endl;
context.Reporter.Error() << Resource::String::MSStoreDownloadNoApplicablePackageFound << std::endl;
break;
case APPINSTALLER_CLI_ERROR_SFSCLIENT_PACKAGE_NOT_SUPPORTED:
context.Reporter.Error() << Resource::String::MSStoreDownloadPackageDownloadNotSupported << std::endl;
break;
default:
context.Reporter.Error() << Resource::String::MSStoreDownloadGetDownloadInfoFailed << std::endl;
}

throw;
AICLI_TERMINATE_CONTEXT(re.GetErrorCode());
}

bool skipDependencies = context.Args.Contains(Execution::Args::Type::SkipDependencies);
Expand Down Expand Up @@ -368,9 +372,18 @@ namespace AppInstaller::CLI::Workflow
}
catch (const wil::ResultException& re)
{
AICLI_LOG(CLI, Error, << "Getting MSStore package license failed. Error code: " << re.GetErrorCode());
context.Reporter.Error() << Resource::String::MSStoreDownloadGetLicenseFailed << std::endl;
throw;
if (re.GetErrorCode() == APPINSTALLER_CLI_ERROR_LICENSING_API_FAILED_FORBIDDEN)
{
AICLI_LOG(CLI, Warning, << "Getting MSStore package license failed. The Microsoft Entra Id account does not have privilege.");
context.Reporter.Warn() << Resource::String::MSStoreDownloadGetLicenseForbidden << std::endl;
}
else
{
AICLI_LOG(CLI, Warning, << "Getting MSStore package license failed. Error code: " << re.GetErrorCode());
context.Reporter.Warn() << Resource::String::MSStoreDownloadGetLicenseFailed << std::endl;
}

AICLI_TERMINATE_CONTEXT(re.GetErrorCode());
}

std::filesystem::path licenseFilePath = downloadDirectory / Utility::ConvertToUTF16(installer.ProductId + "_License.xml");
Expand Down
28 changes: 23 additions & 5 deletions src/AppInstallerCLIPackage/Shared/Strings/en-us/winget.resw
Original file line number Diff line number Diff line change
Expand Up @@ -2896,13 +2896,13 @@ Please specify one of them using the --source option to proceed.</value>
<value>Failed to get Microsoft Store package download information.</value>
</data>
<data name="APPINSTALLER_CLI_ERROR_NO_APPLICABLE_SFSCLIENT_PACKAGE" xml:space="preserve">
<value>No applicable Microsoft Store package download information found.</value>
<value>No applicable Microsoft Store package found for download.</value>
</data>
<data name="APPINSTALLER_CLI_ERROR_LICENSING_API_FAILED" xml:space="preserve">
<value>Failed to retrieve Microsoft Store package license.</value>
</data>
<data name="MSStoreDownloadPackageNotFound" xml:space="preserve">
<value>The Microsoft Store package could not be found.</value>
<data name="MSStoreDownloadNoApplicablePackageFound" xml:space="preserve">
<value>No applicable Microsoft Store package found.</value>
</data>
<data name="MSStoreDownloadPackageHashVerified" xml:space="preserve">
<value>Successfully verified Microsoft Store package hash</value>
Expand Down Expand Up @@ -2948,7 +2948,8 @@ Please specify one of them using the --source option to proceed.</value>
<comment>{Locked="--rename"}</comment>
</data>
<data name="MSStoreDownloadAuthenticationNotice" xml:space="preserve">
<value>Microsoft Store package download requires Microsoft Entra Id authentication. Authentication prompt may appear when necessary. Authenticated information will be shared with Microsoft services for access authorization. For Microsoft Store package licensing, the Microsoft Entra Id account needs to have administrator access to the Microsoft Entra Id tenant.</value>
<value>Microsoft Store package download requires Microsoft Entra Id authentication. Authentication prompt may appear when necessary. Authenticated information will be shared with Microsoft services for access authorization. For Microsoft Store package licensing, the Microsoft Entra Id account needs to be a member of Global Administrator, User Administrator, or License Administrator.</value>
<comment>{Locked="Global Administrator,User Administrator,License Administrator"}</comment>
</data>
<data name="SkipMicrosoftStorePackageLicenseArgumentDescription" xml:space="preserve">
<value>Skips retrieving Microsoft Store package offline license</value>
Expand Down Expand Up @@ -3112,4 +3113,21 @@ Please specify one of them using the --source option to proceed.</value>
<data name="ConfigurationSuppressPrologueArgumentDescription" xml:space="preserve">
<value>Suppress showing initial configuration details when possible</value>
</data>
</root>
<data name="MSStoreDownloadMultiplePackagesNotice" xml:space="preserve">
<value>Multiple Microsoft Store packages may be downloaded targeting different platforms and architectures. --platform, --architecture can be used to filter the packages.</value>
<comment>{Locked="--platform--architecture"}</comment>
</data>
<data name="MSStoreDownloadGetLicenseForbidden" xml:space="preserve">
<value>Failed to retrieve Microsoft Store package license. The Microsoft Entra Id account is not a member of Global Administrator, User Administrator, or License Administrator. Use --skip-license to skip retrieving Microsoft Store package license.</value>
<comment>{Locked="Global Administrator,User Administrator,License Administrator,--skip-license"}</comment>
</data>
<data name="MSStoreDownloadPackageDownloadNotSupported" xml:space="preserve">
<value>The Microsoft Store package does not support download.</value>
</data>
<data name="APPINSTALLER_CLI_ERROR_SFSCLIENT_PACKAGE_NOT_SUPPORTED" xml:space="preserve">
<value>The Microsoft Store package does not support download.</value>
</data>
<data name="APPINSTALLER_CLI_ERROR_LICENSING_API_FAILED_FORBIDDEN" xml:space="preserve">
<value>Failed to retrieve Microsoft Store package license. The Microsoft Entra Id account does not have required privilege.</value>
</data>
</root>
Loading
Loading