Add securityContext to configuration files (#38017)

For the winget DSC, Setting developer mode, installing Visual Studio 2022 & fetching and installing VS components all require elevation. Added securityContext: elevated for these resources. These configurations can now be invoked from user context, and will prompt for a single UAC to run resources that require elevation in a separate process.
This commit is contained in:
Muhammad Danish
2025-04-14 04:19:22 +05:00
committed by GitHub
parent b32c04fca1
commit 5c8aa67781
3 changed files with 18 additions and 0 deletions

View File

@@ -6,12 +6,16 @@ properties:
directives: directives:
description: Enable Developer Mode description: Enable Developer Mode
allowPrerelease: true allowPrerelease: true
# Requires elevation for the set operation
securityContext: elevated
settings: settings:
Ensure: Present Ensure: Present
- resource: Microsoft.WinGet.DSC/WinGetPackage - resource: Microsoft.WinGet.DSC/WinGetPackage
id: vsPackage id: vsPackage
directives: directives:
description: Install Visual Studio 2022 Enterprise (Any edition will work) description: Install Visual Studio 2022 Enterprise (Any edition will work)
# Requires elevation for the set operation
securityContext: elevated
settings: settings:
id: Microsoft.VisualStudio.2022.Enterprise id: Microsoft.VisualStudio.2022.Enterprise
source: winget source: winget
@@ -21,6 +25,8 @@ properties:
directives: directives:
description: Install required VS workloads description: Install required VS workloads
allowPrerelease: true allowPrerelease: true
# Requires elevation for the get and set operations
securityContext: elevated
settings: settings:
productId: Microsoft.VisualStudio.Product.Enterprise productId: Microsoft.VisualStudio.Product.Enterprise
channelId: VisualStudio.17.Release channelId: VisualStudio.17.Release

View File

@@ -6,12 +6,16 @@ properties:
directives: directives:
description: Enable Developer Mode description: Enable Developer Mode
allowPrerelease: true allowPrerelease: true
# Requires elevation for the set operation
securityContext: elevated
settings: settings:
Ensure: Present Ensure: Present
- resource: Microsoft.WinGet.DSC/WinGetPackage - resource: Microsoft.WinGet.DSC/WinGetPackage
id: vsPackage id: vsPackage
directives: directives:
description: Install Visual Studio 2022 Professional (Any edition will work) description: Install Visual Studio 2022 Professional (Any edition will work)
# Requires elevation for the set operation
securityContext: elevated
settings: settings:
id: Microsoft.VisualStudio.2022.Professional id: Microsoft.VisualStudio.2022.Professional
source: winget source: winget
@@ -21,6 +25,8 @@ properties:
directives: directives:
description: Install required VS workloads description: Install required VS workloads
allowPrerelease: true allowPrerelease: true
# Requires elevation for the get and set operations
securityContext: elevated
settings: settings:
productId: Microsoft.VisualStudio.Product.Professional productId: Microsoft.VisualStudio.Product.Professional
channelId: VisualStudio.17.Release channelId: VisualStudio.17.Release

View File

@@ -6,12 +6,16 @@ properties:
directives: directives:
description: Enable Developer Mode description: Enable Developer Mode
allowPrerelease: true allowPrerelease: true
# Requires elevation for the set operation
securityContext: elevated
settings: settings:
Ensure: Present Ensure: Present
- resource: Microsoft.WinGet.DSC/WinGetPackage - resource: Microsoft.WinGet.DSC/WinGetPackage
id: vsPackage id: vsPackage
directives: directives:
description: Install Visual Studio 2022 Community (Any edition will work) description: Install Visual Studio 2022 Community (Any edition will work)
# Requires elevation for the set operation
securityContext: elevated
settings: settings:
id: Microsoft.VisualStudio.2022.Community id: Microsoft.VisualStudio.2022.Community
source: winget source: winget
@@ -21,6 +25,8 @@ properties:
directives: directives:
description: Install required VS workloads description: Install required VS workloads
allowPrerelease: true allowPrerelease: true
# Requires elevation for the get and set operations
securityContext: elevated
settings: settings:
productId: Microsoft.VisualStudio.Product.Community productId: Microsoft.VisualStudio.Product.Community
channelId: VisualStudio.17.Release channelId: VisualStudio.17.Release