Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Prevent users from setting ApiVersion to 'Unknown' in Set-PSResourceRepository #1892

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

Draft
Copilot wants to merge 2 commits into master
base: master
Choose a base branch
Loading
from copilot/remove-unknown-api-version

Conversation

Copy link
Contributor

Copilot AI commented Oct 8, 2025
edited
Loading

Summary

This PR prevents users from explicitly setting ApiVersion to Unknown when using the Set-PSResourceRepository cmdlet. The Unknown value is reserved for internal use when the system cannot automatically determine a repository's type, and allowing users to set it explicitly would create non-functional repositories.

Problem

Previously, users could set a repository's ApiVersion to "unknown":

Set-PSResourceRepository -Name "MyRepo" -ApiVersion "unknown"
# This would succeed but make the repository unusable

When a repository has ApiVersion.Unknown, cmdlets like Find-PSResource and Install-PSResource detect this and throw errors indicating the repository type is not supported, making the repository completely non-functional.

Changes

Code Changes

  • src/code/SetPSResourceRepository.cs: Added validation to throw a clear error when users attempt to set ApiVersion to Unknown, with a helpful message listing the valid values (V2, V3, Local, NugetServer, ContainerRegistry)

Test Changes

  • test/ResourceRepositoryTests/SetPSResourceRepository.Tests.ps1: Updated the test to verify that attempting to set ApiVersion to "unknown" now throws the expected error and leaves the repository unchanged

New Behavior

Set-PSResourceRepository -Name "MyRepo" -ApiVersion "unknown"
# Now throws: "ApiVersion 'Unknown' is not a valid value for Set-PSResourceRepository. 
# Valid values are: V2, V3, Local, NugetServer, ContainerRegistry"

All other ApiVersion values continue to work as expected.

Fixes

Closes #1878

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • 1k9vsblobprodcus379.vsblob.vsassets.io
    • Triggering command: /usr/bin/dotnet publish --configuration Debug --framework net472 --output bin/Debug/net472/publish (dns block)
  • 37cvsblobprodcus359.vsblob.vsassets.io
    • Triggering command: /usr/bin/dotnet publish --configuration Debug --framework net472 --output bin/Debug/net472/publish (dns block)
  • 4myvsblobprodcus32.vsblob.vsassets.io
    • Triggering command: /usr/bin/dotnet publish --configuration Debug --framework net472 --output bin/Debug/net472/publish (dns block)
    • Triggering command: dotnet restore --ignore-failed-sources (dns block)
  • 51yvsblobprodcus36.vsblob.vsassets.io
    • Triggering command: /usr/bin/dotnet publish --configuration Debug --framework net472 --output bin/Debug/net472/publish (dns block)
    • Triggering command: dotnet restore --ignore-failed-sources (dns block)
  • 5dkvsblobprodcus355.vsblob.vsassets.io
    • Triggering command: /usr/bin/dotnet publish --configuration Debug --framework net472 --output bin/Debug/net472/publish (dns block)
  • 7devsblobprodcus323.vsblob.vsassets.io
    • Triggering command: /usr/bin/dotnet publish --configuration Debug --framework net472 --output bin/Debug/net472/publish (dns block)
    • Triggering command: dotnet restore --ignore-failed-sources (dns block)
  • 7k6vsblobprodcus337.vsblob.vsassets.io
    • Triggering command: /usr/bin/dotnet publish --configuration Debug --framework net472 --output bin/Debug/net472/publish (dns block)
    • Triggering command: dotnet restore --ignore-failed-sources (dns block)
  • 7tjvsblobprodcus341.vsblob.vsassets.io
    • Triggering command: /usr/bin/dotnet publish --configuration Debug --framework net472 --output bin/Debug/net472/publish (dns block)
  • bcnvsblobprodcus378.vsblob.vsassets.io
    • Triggering command: /usr/bin/dotnet publish --configuration Debug --framework net472 --output bin/Debug/net472/publish (dns block)
    • Triggering command: dotnet restore --ignore-failed-sources (dns block)
  • c50vsblobprodcus330.vsblob.vsassets.io
    • Triggering command: /usr/bin/dotnet publish --configuration Debug --framework net472 --output bin/Debug/net472/publish (dns block)
    • Triggering command: /home/REDACTED/work/_temp/ghcca-node/node/bin/node --enable-source-maps /home/REDACTED/work/_temp/copilot-developer-action-main/dist/index.js (dns block)
  • c78vsblobprodcus322.vsblob.vsassets.io
    • Triggering command: /usr/bin/dotnet publish --configuration Debug --framework net472 --output bin/Debug/net472/publish (dns block)
  • dlbvsblobprodcus316.vsblob.vsassets.io
    • Triggering command: /usr/bin/dotnet publish --configuration Debug --framework net472 --output bin/Debug/net472/publish (dns block)
    • Triggering command: dotnet restore --ignore-failed-sources (dns block)
  • fdpvsblobprodcus345.vsblob.vsassets.io
    • Triggering command: /usr/bin/dotnet publish --configuration Debug --framework net472 --output bin/Debug/net472/publish (dns block)
  • gbsvsblobprodcus365.vsblob.vsassets.io
    • Triggering command: /usr/bin/dotnet publish --configuration Debug --framework net472 --output bin/Debug/net472/publish (dns block)
    • Triggering command: dotnet restore --ignore-failed-sources (dns block)
  • kh4vsblobprodcus325.vsblob.vsassets.io
    • Triggering command: /usr/bin/dotnet publish --configuration Debug --framework net472 --output bin/Debug/net472/publish (dns block)
  • kmuvsblobprodcus389.vsblob.vsassets.io
    • Triggering command: /usr/bin/dotnet publish --configuration Debug --framework net472 --output bin/Debug/net472/publish (dns block)
    • Triggering command: dotnet restore --ignore-failed-sources (dns block)
  • l49vsblobprodcus358.vsblob.vsassets.io
    • Triggering command: /usr/bin/dotnet publish --configuration Debug --framework net472 --output bin/Debug/net472/publish (dns block)
  • m6xvsblobprodcus342.vsblob.vsassets.io
    • Triggering command: /usr/bin/dotnet publish --configuration Debug --framework net472 --output bin/Debug/net472/publish (dns block)
    • Triggering command: dotnet restore --ignore-failed-sources (dns block)
  • pkvvsblobprodcus321.vsblob.vsassets.io
    • Triggering command: /usr/bin/dotnet publish --configuration Debug --framework net472 --output bin/Debug/net472/publish (dns block)
  • s4uvsblobprodcus326.vsblob.vsassets.io
    • Triggering command: /usr/bin/dotnet publish --configuration Debug --framework net472 --output bin/Debug/net472/publish (dns block)
    • Triggering command: dotnet restore --ignore-failed-sources (dns block)
  • tphvsblobprodcus375.vsblob.vsassets.io
    • Triggering command: /usr/bin/dotnet publish --configuration Debug --framework net472 --output bin/Debug/net472/publish (dns block)
    • Triggering command: dotnet restore --ignore-failed-sources (dns block)
  • uy6vsblobprodcus34.vsblob.vsassets.io
    • Triggering command: /usr/bin/dotnet publish --configuration Debug --framework net472 --output bin/Debug/net472/publish (dns block)
  • yttvsblobprodcus357.vsblob.vsassets.io
    • Triggering command: /usr/bin/dotnet publish --configuration Debug --framework net472 --output bin/Debug/net472/publish (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Original prompt

This section details on the original issue you should resolve

<issue_title>Set-PSResourceRepository API version to unknown</issue_title>
<issue_description>### Prerequisites

  • Write a descriptive title.
  • Make sure you are able to repro it on the latest released version
  • Search the existing issues.

Steps to reproduce

Is there a valid workflow in letting a user set the API version of a repository to unknown? If not then that should be removed as a valid value.

Expected behavior

^

Actual behavior

^

Error details

No response

Environment data

7.4-preview5
rc1

Visuals

No response</issue_description>

<agent_instructions>in 'Set-PSResourceRepository' do not allow users to set 'ApiVersion' to 'unknown'</agent_instructions>

Comments on the Issue (you are @copilot in this section)

Fixes #1419

✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

...urceRepository
Co-authored-by: alerickson <25858831+alerickson@users.noreply.github.com>
Copilot AI changed the title (削除) [WIP] Remove ability to set API version to unknown (削除ここまで) (追記) Prevent users from setting ApiVersion to 'Unknown' in Set-PSResourceRepository (追記ここまで) Oct 8, 2025
Copilot AI requested a review from alerickson October 8, 2025 19:14
Copilot finished work on behalf of alerickson October 8, 2025 19:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@alerickson alerickson Awaiting requested review from alerickson alerickson is a code owner

@anamnavi anamnavi Awaiting requested review from anamnavi anamnavi will be requested when the pull request is marked ready for review anamnavi is a code owner

@adityapatwardhan adityapatwardhan Awaiting requested review from adityapatwardhan adityapatwardhan will be requested when the pull request is marked ready for review adityapatwardhan is a code owner

@SydneyhSmith SydneyhSmith Awaiting requested review from SydneyhSmith SydneyhSmith will be requested when the pull request is marked ready for review SydneyhSmith is a code owner

At least 1 approving review is required to merge this pull request.

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

When updating a resource, dependent resources are also updated, even when unnecessary Set-PSResourceRepository API version to unknown

2 participants

AltStyle によって変換されたページ (->オリジナル) /