This repository is the reference implementation for a Windows Package Manager REST source — an Azure-hosted package source that a WinGet client can query. It includes both the deployable Azure Functions REST API and a PowerShell module for provisioning/managing REST source infrastructure.
src/WinGet.RestSource.Functions- Azure Functions implementing the REST API endpoints (manifest search, get, information)src/WinGet.RestSource- Core models and business logic shared by the Functions appsrc/WinGet.RestSource.Infrastructure- Data access layer (CosmosDB)src/WinGet.RestSource.AppConfig- Application configurationsrc/WinGet.RestSource.PowershellSupport/Tools/PowershellModule-Microsoft.WinGet.RestSourcePowerShell module for creating/managing REST sources on Azuresrc/WinGet.RestSource.UnitTest/IntegrationTest/Fuzzing- Test projectssrc/WinGet.RestSource.Utils- Shared utility code
- Git LFS
- Visual Studio 2022 with .NET desktop development, Azure development, and ASP.NET and web development workloads
Open src\WinGet.RestSource.sln in Visual Studio and build. Command-line builds of the solution also work.
- Run
generate_self_sign_cert.ps1insrc\WinGet.RestSource.Functionsto create a local HTTPS dev cert (used automatically vialaunchSettings.json). - Provision a CosmosDB instance (database
WinGet, collectionManifestsif using the ARM templates). - Copy
local.settings.template.jsontolocal.settings.jsonand populate connection info. - For fully anonymous local testing, set HttpTrigger level to
AnonymousforInformationGet,ManifestSearchPost, andManifestGet. - Run
WinGet.RestSource.Functionsvia F5 in Visual Studio. - Add as a WinGet source:
winget source add -n "winget-pkgs-restsource" -a https://localhost:7071/api/ -t "Microsoft.Rest".
- Unit tests: require the Cosmos DB Emulator; configure via
WinGet.RestSource.UnitTest\Test.runsettings.template.json→Test.runsettings.json. - Integration tests: require a deployed REST source endpoint and the winget client installed locally; configure via
WinGet.RestSource.IntegrationTest\Test.runsettings.template.json. Destructive/write tests are disabled by default (RunWriteTests). - Run tests from Visual Studio Test Explorer (
Test > Run All Tests).
- Azure Functions HTTP triggers map directly to REST endpoints consumed by the WinGet client's
Microsoft.Restsource type. - CosmosDB is the backing store for manifest documents; access is abstracted through the Infrastructure layer.
- The PowerShell module (
Microsoft.WinGet.RestSource) wraps ARM/Azure CLI operations to stand up the Functions app, CosmosDB, and supporting resources declaratively. - REST endpoint contracts should stay in sync with the WinGet client's expectations in microsoft/winget-cli — check client-side REST source parsing when changing response shapes.
- C# code follows StyleCop rules in
stylecop.json. - Namespaces follow
Microsoft.WindowsPackageManager.Rest.<Area>.
- Review
CONTRIBUTING.md(root) for workflow and CLA requirements. - Documentation for the PowerShell module lives in
Tools/PowershellModule/doc/WingetRestSource.md.