Skip to content

Conversation

Copilot
Copy link

@Copilot Copilot AI commented Oct 8, 2025

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 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 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
Labels
None yet
Projects
None yet
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