{"id":13289057,"url":"https://github.com/rbjoergensen/publish-pwsh-module","last_synced_at":"2026-01-16T09:36:25.166Z","repository":{"id":40519001,"uuid":"484206557","full_name":"rbjoergensen/publish-pwsh-module","owner":"rbjoergensen","description":"How to build a PowerShell module and publish it to Azure DevOps and GitHub package feeds.","archived":false,"fork":false,"pushed_at":"2022-06-26T22:23:42.000Z","size":50,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-08T04:43:36.333Z","etag":null,"topics":["azure-devops","devops","powershell"],"latest_commit_sha":null,"homepage":"","language":"PowerShell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/rbjoergensen.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2022-04-21T21:12:35.000Z","updated_at":"2022-06-14T21:30:35.000Z","dependencies_parsed_at":"2022-07-26T06:32:12.603Z","dependency_job_id":null,"html_url":"https://github.com/rbjoergensen/publish-pwsh-module","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rbjoergensen%2Fpublish-pwsh-module","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rbjoergensen%2Fpublish-pwsh-module/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rbjoergensen%2Fpublish-pwsh-module/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rbjoergensen%2Fpublish-pwsh-module/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rbjoergensen","download_url":"https://codeload.github.com/rbjoergensen/publish-pwsh-module/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":242805687,"owners_count":20187996,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["azure-devops","devops","powershell"],"created_at":"2024-07-29T17:00:25.213Z","updated_at":"2026-01-16T09:36:25.155Z","avatar_url":"https://github.com/rbjoergensen.png","language":"PowerShell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Build and publish PowerShell modules\n## Build and Publish using the Azure DevOps template\nIn this example I'm using the template from an external source on GitHub instead of the one local to the repository.\nI'm specifying the name I want the package to have and the feed in my current organization that i want to publish to.\n\u003cbr/\u003e\u003cbr/\u003e\nThe path to the module is expected to have file called `RootModule.psm1` with the same content as in the example and a folder called `Public`.\nThe public folder should contain a file for each function named exactly after the function inside. \nThis is so that the build script can automatically include each function in the manifest.\n``` yaml\ntrigger:\n  branches:\n    include:\n      - main\n  paths:\n    include:\n      - modules/Example/**\n\nresources:\n  repositories:\n  - repository: templates\n    type: github\n    name: rbjoergensen/azure-devops-templates\n\nstages:\n- template: /powershell/build.yml@templates\n  parameters:\n    name: MyTestPackage\n    path: $(System.DefaultWorkingDirectory)/modules/Example\n    feed: PowerShell\n    author: github.com/rbjoergensen\n    company: CallOfTheVoid\n    descritpion: An example module\n```\n## Installing a package from an Azure DevOps feed\nPowerShell doesn't support v3 as of writing.\n``` powershell\n$token = \"\u003cPersonalAccessToken\u003e\"\n\n$feed = \"https://pkgs.dev.azure.com/callofthevoid/_packaging/Powershell/nuget/v2\"\n$source = \"CotvPowerShell\"\n\n[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12\n\n$credential = New-Object System.Management.Automation.PSCredential(\"whatever\", \n    ($token | ConvertTo-SecureString -AsPlainText -Force))\n\nRegister-PackageSource `\n    -Name $source `\n    -ProviderName PowerShellGet `\n    -Location $feed `\n    -Trusted `\n    -Credential $credential `\n    -Force\n\nInstall-Module `\n    -Name \"\u003cNameOfPackage\u003e\" `\n    -Repository $source `\n    -Force `\n    -Credential $credential\n```\n## Creating a personal access token(PAT)\nTo create a personal access token go to your organization at this link.\u003cbr/\u003e\nhttps://dev.azure.com/myorganization/_usersSettings/tokens.\u003cbr/\u003e\n\nJust replace the organization with the name of your own. Click on `+ New token` and give it the scope `Packaging: Read`.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frbjoergensen%2Fpublish-pwsh-module","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frbjoergensen%2Fpublish-pwsh-module","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frbjoergensen%2Fpublish-pwsh-module/lists"}