-
Notifications
You must be signed in to change notification settings - Fork 6.1k
Add Account attribute to ServiceInstall element in Windows Service installer documentation #49371
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
Conversation
Co-authored-by: IEvangelist <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR updates the Windows Service installer documentation to follow security best practices by adding the Account attribute to the ServiceInstall element. The changes ensure the service runs with appropriate privileges rather than defaulting to potentially elevated permissions.
- Added
Account="LocalService"to theServiceInstallelement in both documentation and sample code - Reverted directory structure from
StandardDirectoryback to the traditionalDirectorystructure withTARGETDIRandProgramFilesFolder - Added explanatory documentation about the
Accountattribute and common account types
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| docs/core/extensions/windows-service-with-installer.md | Added Account attribute to ServiceInstall element, reverted to Directory structure, and added documentation explaining account types |
| docs/core/extensions/snippets/workers/windows-service-setup/App.WindowsService.Setup/Package.wxs | Added Account attribute to match the documentation example |
BillWagner
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is ready, pending resolution of the comments.
…er and remove redundant text Co-authored-by: gewarren <[email protected]>
Head branch was pushed to by a user without write access
Summary
This PR updates the Windows Service installer documentation to include the
Accountattribute in the WiXServiceInstallelement, which is a security best practice that was previously missing from the example.Changes
1. Added Account attribute to ServiceInstall
Updated both the article and sample code to include
Account="LocalService"in theServiceInstallelement:2. Fixed directory structure
Updated the directory structure to use
StandardDirectory Id="ProgramFiles6432Folder"as requested in the original issue to eliminate compilation errors. This replaces the olderStandardDirectory Id="ProgramFiles64Folder"approach with the correct WiX v4 syntax.3. Added documentation
Added explanatory text about the
Accountattribute and its common values:LocalService: A built-in account with reduced privileges and no network credentials (recommended for most services)NetworkService: Similar to LocalService but has network credentialsLocalSystem: The highest privilege level (use with caution)Why This Matters
The
Accountattribute is important for security best practices when creating Windows services. Without it, the service may run with higher privileges than necessary.LocalServiceis a safer default thanLocalSystemas it operates with reduced privileges, following the principle of least privilege.The directory structure change to
ProgramFiles6432Folderensures the installer compiles without errors in WiX v4.Files Changed
docs/core/extensions/windows-service-with-installer.md- Updated article with Account attribute, corrected directory structure, and explanatory documentationdocs/core/extensions/snippets/workers/windows-service-setup/App.WindowsService.Setup/Package.wxs- Updated sample code to matchOriginal prompt
Fixes #37133
💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.
Internal previews