commit 82f994d0692d4b9fbbcbc1913d83971f70d46414
parent 63dc4bbc4a730b3d8815f163bac66d050a5b5fbf
Author: Luis Chacón <lechacon@users.noreply.github.com>
Date: Tue, 6 Apr 2021 15:42:04 -0700
Add ADMX definition for Group Policy (#809)
Diffstat:
7 files changed, 248 insertions(+), 10 deletions(-)
diff --git a/.github/actions/spelling/expect.txt b/.github/actions/spelling/expect.txt
@@ -1,4 +1,6 @@
abcd
+adml
+admx
AFX
agg
aicli
@@ -274,4 +276,5 @@ wsv
wto
Wunused
WZDNCRFJ
+xsi
zy
diff --git a/azure-pipelines.loc.yml b/azure-pipelines.loc.yml
@@ -18,18 +18,35 @@ jobs:
vmImage: windows-2019
variables:
skipComponentGovernanceDetection: true
+ tdbuildTeamId: 8343
+ tdbuildAuthId: 2796a411-f030-46c1-ae3e-ab56f60ea523
+ tdbuildAuthKey: $(LocServiceKey)
steps:
+ # Upload client resources
- task: MicrosoftTDBuild.tdbuild-task.tdbuild-task.TouchdownBuildTask@1
displayName: Send resources to Touchdown Build
inputs:
- teamId: 8343
- authId: 2796a411-f030-46c1-ae3e-ab56f60ea523
- authKey: $(LocServiceKey)
+ teamId: $(tdbuildTeamId)
+ authId: $(tdbuildAuthId)
+ authKey: $(tdbuildAuthKey)
isPreview: false
relativePathRoot: src\AppInstallerCLIPackage\Shared\Strings\en-us
resourceFilePath: '*.resw'
outputDirectoryRoot: localization/Resources/
+ # Upload Group Policy ADML
+ # Do it as a separate step as we need the result in a different location
+ - task: MicrosoftTDBuild.tdbuild-task.tdbuild-task.TouchdownBuildTask@1
+ displayName: Send ADML to Touchdown Build
+ inputs:
+ teamId: $(tdbuildTeamId)
+ authId: $(tdbuildAuthId)
+ authKey: $(tdbuildAuthKey)
+ isPreview: false
+ relativePathRoot: doc\admx\en-US
+ resourceFilePath: '*.adml'
+ outputDirectoryRoot: doc\admx
+
- script: |
cd $(Build.SourcesDirectory)
git add -A
diff --git a/doc/admx/DesktopAppInstaller.admx b/doc/admx/DesktopAppInstaller.admx
@@ -0,0 +1,120 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (c) Microsoft Corporation.
+ Licensed under the MIT License. -->
+<policyDefinitions xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" revision="1.0" schemaVersion="1.0" xmlns="http://schemas.microsoft.com/GroupPolicy/2006/07/PolicyDefinitions">
+ <policyNamespaces>
+ <target prefix="appinstaller" namespace="Microsoft.Policies.AppInstaller" />
+ <using prefix="windows" namespace="Microsoft.Policies.Windows" />
+ </policyNamespaces>
+ <resources minRequiredRevision="1.0" />
+ <categories>
+ <category name="AppInstaller" displayName="$(string.AppInstaller)">
+ <parentCategory ref="windows:WindowsComponents" />
+ </category>
+ </categories>
+ <policies>
+ <policy name="EnableAppInstaller" class="Machine" displayName="$(string.EnableAppInstaller)" explainText="$(string.EnableAppInstallerExplanation)" key="Software\Policies\Microsoft\Windows\AppInstaller" valueName="EnableAppInstaller">
+ <parentCategory ref="AppInstaller" />
+ <supportedOn ref="windows:SUPPORTED_Windows_10_0_RS3" />
+ <enabledValue>
+ <decimal value="1" />
+ </enabledValue>
+ <disabledValue>
+ <decimal value="0" />
+ </disabledValue>
+ </policy>
+ <policy name="EnableSettings" class="Machine" displayName="$(string.EnableSettings)" explainText="$(string.EnableSettingsExplanation)" key="Software\Policies\Microsoft\Windows\AppInstaller" valueName="EnableSettings">
+ <parentCategory ref="AppInstaller" />
+ <supportedOn ref="windows:SUPPORTED_Windows_10_0_RS3" />
+ <enabledValue>
+ <decimal value="1" />
+ </enabledValue>
+ <disabledValue>
+ <decimal value="0" />
+ </disabledValue>
+ </policy>
+ <policy name="EnableExperimentalFeatures" class="Machine" displayName="$(string.EnableExperimentalFeatures)" explainText="$(string.EnableExperimentalFeaturesExplanation)" key="Software\Policies\Microsoft\Windows\AppInstaller" valueName="EnableExperimentalFeatures">
+ <parentCategory ref="AppInstaller" />
+ <supportedOn ref="windows:SUPPORTED_Windows_10_0_RS3" />
+ <enabledValue>
+ <decimal value="1" />
+ </enabledValue>
+ <disabledValue>
+ <decimal value="0" />
+ </disabledValue>
+ </policy>
+ <policy name="EnableLocalManifestFiles" class="Machine" displayName="$(string.EnableLocalManifestFiles)" explainText="$(string.EnableLocalManifestFilesExplanation)" key="Software\Policies\Microsoft\Windows\AppInstaller" valueName="EnableLocalManifestFiles">
+ <parentCategory ref="AppInstaller" />
+ <supportedOn ref="windows:SUPPORTED_Windows_10_0_RS3" />
+ <enabledValue>
+ <decimal value="1" />
+ </enabledValue>
+ <disabledValue>
+ <decimal value="0" />
+ </disabledValue>
+ </policy>
+ <policy name="EnableHashOverride" class="Machine" displayName="$(string.EnableHashOverride)" explainText="$(string.EnableHashOverrideExplanation)" key="Software\Policies\Microsoft\Windows\AppInstaller" valueName="EnableHashOverride">
+ <parentCategory ref="AppInstaller" />
+ <supportedOn ref="windows:SUPPORTED_Windows_10_0_RS3" />
+ <enabledValue>
+ <decimal value="1" />
+ </enabledValue>
+ <disabledValue>
+ <decimal value="0" />
+ </disabledValue>
+ </policy>
+ <policy name="EnableDefaultSource" class="Machine" displayName="$(string.EnableDefaultSource)" explainText="$(string.EnableDefaultSourceExplanation)" key="Software\Policies\Microsoft\Windows\AppInstaller" valueName="EnableDefaultSource">
+ <parentCategory ref="AppInstaller" />
+ <supportedOn ref="windows:SUPPORTED_Windows_10_0_RS3" />
+ <enabledValue>
+ <decimal value="1" />
+ </enabledValue>
+ <disabledValue>
+ <decimal value="0" />
+ </disabledValue>
+ </policy>
+ <policy name="EnableMicrosoftStoreSource" class="Machine" displayName="$(string.EnableMicrosoftStoreSource)" explainText="$(string.EnableMicrosoftStoreSourceExplanation)" key="Software\Policies\Microsoft\Windows\AppInstaller" valueName="EnableMicrosoftStoreSource">
+ <parentCategory ref="AppInstaller" />
+ <supportedOn ref="windows:SUPPORTED_Windows_10_0_RS3" />
+ <enabledValue>
+ <decimal value="1" />
+ </enabledValue>
+ <disabledValue>
+ <decimal value="0" />
+ </disabledValue>
+ </policy>
+ <policy name="SourceAutoUpdateIntervalInMinutes" class="Machine" displayName="$(string.SourceAutoUpdateIntervalInMinutes)" explainText="$(string.SourceAutoUpdateIntervalInMinutesExplanation)" presentation="$(presentation.SourceAutoUpdateIntervalInMinutes)" key="Software\Policies\Microsoft\Windows\AppInstaller">
+ <parentCategory ref="AppInstaller" />
+ <supportedOn ref="windows:SUPPORTED_Windows_10_0_RS3" />
+ <elements>
+ <decimal id="SourceAutoUpdateIntervalInMinutes" valueName="SourceAutoUpdateIntervalInMinutes" maxValue="43200" />
+ </elements>
+ </policy>
+ <policy name="EnableAdditionalSources" class="Machine" displayName="$(string.EnableAdditionalSources)" explainText="$(string.EnableAdditionalSourcesExplanation)" presentation="$(presentation.AdditionalSources)" key="Software\Policies\Microsoft\Windows\AppInstaller" valueName="EnableAdditionalSources">
+ <parentCategory ref="AppInstaller" />
+ <supportedOn ref="windows:SUPPORTED_Windows_10_0_RS3" />
+ <enabledValue>
+ <decimal value="1" />
+ </enabledValue>
+ <disabledValue>
+ <decimal value="0" />
+ </disabledValue>
+ <elements>
+ <list id="AdditionalSources" key="Software\Policies\Microsoft\Windows\AppInstaller\AdditionalSources" valuePrefix="" />
+ </elements>
+ </policy>
+ <policy name="EnableAllowedSources" class="Machine" displayName="$(string.EnableAllowedSources)" explainText="$(string.EnableAllowedSourcesExplanation)" presentation="$(presentation.AllowedSources)" key="Software\Policies\Microsoft\Windows\AppInstaller" valueName="EnableAllowedSources">
+ <parentCategory ref="AppInstaller" />
+ <supportedOn ref="windows:SUPPORTED_Windows_10_0_RS3" />
+ <enabledValue>
+ <decimal value="1" />
+ </enabledValue>
+ <disabledValue>
+ <decimal value="0" />
+ </disabledValue>
+ <elements>
+ <list id="AllowedSources" key="Software\Policies\Microsoft\Windows\AppInstaller\AllowedSources" valuePrefix="" />
+ </elements>
+ </policy>
+ </policies>
+</policyDefinitions>+
\ No newline at end of file
diff --git a/doc/admx/en-US/DesktopAppInstaller.adml b/doc/admx/en-US/DesktopAppInstaller.adml
@@ -0,0 +1,91 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (c) Microsoft Corporation.
+ Licensed under the MIT License. -->
+<policyDefinitionResources xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" revision="1.0" schemaVersion="1.0" xmlns="http://schemas.microsoft.com/GroupPolicy/2006/07/PolicyDefinitions">
+ <displayName>App Installer</displayName>
+ <description>App Installer</description>
+ <resources>
+ <stringTable>
+ <string id="AppInstaller">Desktop App Installer</string>
+ <string id="EnableAppInstaller">Enable App Installer</string>
+ <string id="EnableAppInstallerExplanation">This policy controls whether the Windows Package Manager can be used by users.
+
+If you enable or do not configure this setting, users will be able to use the Windows Package Manager.
+
+If you disable this setting, users will not be able to use the Windows Package Manager.</string>
+ <string id="EnableSettings">Enable App Installer Settings</string>
+ <string id="EnableSettingsExplanation">This policy controls whether users can change their settings.
+
+If you enable or do not configure this setting, users will be able to change settings for the Windows Package Manager.
+
+If you disable this setting, users will not be able to change settings for the Windows Package Manager.</string>
+ <string id="EnableExperimentalFeatures">Enable App Installer Experimental Features</string>
+ <string id="EnableExperimentalFeaturesExplanation">This policy controls whether users can enable experimental features in the Windows Package Manager.
+
+If you enable or do not configure this setting, users will be able to enable experimental features for the Windows Package Manager.
+
+If you disable this setting, users will not be able to enable experimental features for the Windows Package Manager.</string>
+ <string id="EnableLocalManifestFiles">Enable App Installer Local Manifest Files</string>
+ <string id="EnableLocalManifestFilesExplanation">This policy controls whether users can install packages with local manifest files.
+
+If you enable or do not configure this setting, users will be able to install packages with local manifests using the Windows Package Manager.
+
+If you disable this setting, users will not be able to install packages with local manifests using the Windows Package Manager.</string>
+ <string id="EnableHashOverride">Enable App Installer Hash Override</string>
+ <string id="EnableHashOverrideExplanation">This policy controls whether or not the Windows Package Manager can be configured to enable the ability override the SHA256 security validation in settings.
+
+If you enable or do not configure this policy, users will be able to enable the ability override the SHA256 security validation in the Windows Package Manager settings.
+
+If you disable this policy, users will not be able to enable the ability override the SHA256 security validation in the Windows Package Manager settings.</string>
+ <string id="EnableDefaultSource">Enable App Installer Default Source</string>
+ <string id="EnableDefaultSourceExplanation">This policy controls the default source included with the Windows Package Manager.
+
+If you do not configure this setting, the default source for the Windows Package Manager will be available and can be removed.
+
+If you enable this setting, the default source for the Windows Package Manager will be available and cannot be removed.
+
+If you disable this setting the default source for the Windows Package Manager will not be available.</string>
+ <string id="EnableMicrosoftStoreSource">Enable App Installer Microsoft Store Source</string>
+ <string id="EnableMicrosoftStoreSourceExplanation">This policy controls the Microsoft Store source included with the Windows Package Manager.
+
+If you do not configure this setting, the Microsoft Store source for the Windows Package manager will be available and can be removed.
+
+If you enable this setting, the Microsoft Store source for the Windows Package Manager will be available and cannot be removed.
+
+If you disable this setting the Microsoft Store source for the Windows Package Manager will not be available.</string>
+ <string id="SourceAutoUpdateIntervalInMinutes">Set App Installer Source Auto Update Interval In Minutes</string>
+ <string id="SourceAutoUpdateIntervalInMinutesExplanation">This policy controls the auto update interval for package-based sources.
+
+If you disable or do not configure this setting, the default interval or the value specified in settings will be used by the Windows Package Manager.
+
+If you enable this setting, the number of minutes specified will be used by the Windows Package Manager.</string>
+ <string id="EnableAdditionalSources">Enable App Installer Additional Sources</string>
+ <string id="EnableAdditionalSourcesExplanation">This policy controls additional sources provided by the enterprise IT administrator.
+
+If you do not configure this policy, no additional sources will be configured for the Windows Package Manager.
+
+If you enable this policy, the additional sources will be added to the Windows Package Manager and cannot be removed. The representation for each additional source can be obtained from installed sources using 'winget source export'.
+
+If you disable this policy, no additional sources can be configured for the Windows Package Manager.</string>
+ <string id="EnableAllowedSources">Enable App Installer Allowed Sources</string>
+ <string id="EnableAllowedSourcesExplanation">This policy controls additional sources allowed by the enterprise IT administrator.
+
+If you do not configure this policy, users will be able to add or remove additional sources other than those configured by policy.
+
+If you enable this policy, only the sources specified can be added or removed from the Windows Package Manager. The representation for each allowed source can be obtained from installed sources using 'winget source export'.
+
+If you disable this policy, no additional sources can be configured for the Windows Package Manager.</string>
+ </stringTable>
+ <presentationTable>
+ <presentation id="SourceAutoUpdateIntervalInMinutes">
+ <decimalTextBox refId="SourceAutoUpdateIntervalInMinutes" defaultValue="5">Source Auto Update Interval In Minutes</decimalTextBox>
+ </presentation>
+ <presentation id="AdditionalSources">
+ <listBox refId="AdditionalSources" required="false">Additional Sources: </listBox>
+ </presentation>
+ <presentation id="AllowedSources">
+ <listBox refId="AllowedSources" required="false">Allowed Sources: </listBox>
+ </presentation>
+ </presentationTable>
+ </resources>
+</policyDefinitionResources>
diff --git a/src/AppInstallerCLI.sln b/src/AppInstallerCLI.sln
@@ -92,6 +92,12 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "packages", "packages", "{F5
..\schemas\JSON\packages\packages.schema.1.0.json = ..\schemas\JSON\packages\packages.schema.1.0.json
EndProjectSection
EndProject
+Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "policy", "policy", "{1A47951F-5C7A-4D6D-BB5F-D77484437940}"
+ ProjectSection(SolutionItems) = preProject
+ ..\doc\admx\en-US\DesktopAppInstaller.adml = ..\doc\admx\en-US\DesktopAppInstaller.adml
+ ..\doc\admx\DesktopAppInstaller.admx = ..\doc\admx\DesktopAppInstaller.admx
+ EndProjectSection
+EndProject
Global
GlobalSection(SharedMSBuildProjectFiles) = preSolution
ManifestSchema\ManifestSchema.vcxitems*{1622da16-914f-4f57-a259-d5169003cc8c}*SharedItemsImports = 4
@@ -477,6 +483,7 @@ Global
{F2149997-295A-4593-9282-4C675DFEB670} = {92637527-6CDA-4F4A-84FD-858793776777}
{1487DFBB-7C53-4BD3-9B2C-9B94C6C91528} = {F2149997-295A-4593-9282-4C675DFEB670}
{F5CED6B6-C27F-4405-9033-6C273B8B129C} = {F2149997-295A-4593-9282-4C675DFEB670}
+ {1A47951F-5C7A-4D6D-BB5F-D77484437940} = {8D53D749-D51C-46F8-A162-9371AAA6C2E7}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {B6FDB70C-A751-422C-ACD1-E35419495857}
diff --git a/src/AppInstallerCLITests/TestSettings.h b/src/AppInstallerCLITests/TestSettings.h
@@ -8,8 +8,8 @@
namespace TestCommon
{
// Repeat the policy values here so we can catch unintended changes in the source.
- const std::wstring WinGetPolicyValueName = L"EnableWindowsPackageManager";
- const std::wstring WinGetSettingsPolicyValueName = L"EnableWindowsPackageManagerSettings";
+ const std::wstring WinGetPolicyValueName = L"EnableAppInstaller";
+ const std::wstring WinGetSettingsPolicyValueName = L"EnableSettings";
const std::wstring ExperimentalFeaturesPolicyValueName = L"EnableExperimentalFeatures";
const std::wstring LocalManifestsPolicyValueName = L"EnableLocalManifestFiles";
const std::wstring EnableHashOverridePolicyValueName = L"EnableHashOverride";
diff --git a/src/AppInstallerCommonCore/GroupPolicy.cpp b/src/AppInstallerCommonCore/GroupPolicy.cpp
@@ -10,10 +10,9 @@ namespace AppInstaller::Settings
{
namespace
{
- GroupPolicy& InstanceInternal(std::optional<GroupPolicy*> overridePolicy = {})
+ const GroupPolicy& InstanceInternal(std::optional<GroupPolicy*> overridePolicy = {})
{
- // TODO: Read from the actual registry key
- static GroupPolicy s_groupPolicy{ Registry::Key{} };
+ const static GroupPolicy s_groupPolicy{ Registry::Key::OpenIfExists(HKEY_LOCAL_MACHINE, "Software\\Policies\\Microsoft\\Windows\\AppInstaller") };
static GroupPolicy* s_override = nullptr;
if (overridePolicy.has_value())
@@ -228,9 +227,9 @@ namespace AppInstaller::Settings
switch (policy)
{
case TogglePolicy::Policy::WinGet:
- return TogglePolicy(policy, "EnableWindowsPackageManager"sv, String::PolicyEnableWinGet);
+ return TogglePolicy(policy, "EnableAppInstaller"sv, String::PolicyEnableWinGet);
case TogglePolicy::Policy::Settings: return
- TogglePolicy(policy, "EnableWindowsPackageManagerSettings"sv, String::PolicyEnableWingetSettings);
+ TogglePolicy(policy, "EnableSettings"sv, String::PolicyEnableWingetSettings);
case TogglePolicy::Policy::ExperimentalFeatures:
return TogglePolicy(policy, "EnableExperimentalFeatures"sv, String::PolicyEnableExperimentalFeatures);
case TogglePolicy::Policy::LocalManifestFiles: