microsoft / winget-cli-restsource

This project aims to provide a reference implementation for creating a REST based package source for the winget client.
MIT License
237 stars 60 forks source link

Add-WinGetManifest -SubscriptionName parameter does not work #177

Open ghost opened 1 year ago

ghost commented 1 year ago

I do not use a default Azure subscription, so I need to use -SubscriptionName with Add-WinGetManifest. It appears this parameter is ignored in the implementation and as such the underlying cmdlets continue to try to use the default subscription which subsequently fails.

Using Connect-AzAccount and Set-AzContext prior to execution does not change the outcome of this.

PS D:\b\winget-cli-restsource\bin> add-wingetmanifest -FunctionName "XXX" -Path "D:\b\winget-pkgs\manifests\path_to_manifest" -Verbose -SubscriptionName "XXX"
VERBOSE: Populating RepositorySourceLocation property for module Az.Resources.
VERBOSE: Populating RepositorySourceLocation property for module Az.Accounts.
VERBOSE: Populating RepositorySourceLocation property for module Az.Accounts.
VERBOSE: Populating RepositorySourceLocation property for module Az.Websites.
VERBOSE: Populating RepositorySourceLocation property for module Az.Functions.
VERBOSE: Validating connection to azure, will attempt to connect if not already connected.
VERBOSE: Connected to Azure
VERBOSE: No Subscription Name or Subscription Id provided. Will test connection to default Azure Subscription 
VERBOSE: Determines the Azure Function Resource Group Name
VERBOSE: Verifying that the Azure Resource XXX exists..
VERBOSE: Azure Resources:
           Azure Function Exists:       False
           Azure Resource Group Exists: True
Write-Error: D:\b\winget-cli-restsource\bin\Library\Add-WinGetManifest.ps1:86:19
Line |
  86 |  …   $Result = Test-AzureResource -FunctionName $AzureFunctionName -Reso …
     |                ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     | Both the Azure Function and Resource Group Names can not be null and must exist. Please
     | verify that the Azure function and Resource Group exist.

Exception: D:\b\winget-cli-restsource\bin\Library\Add-WinGetManifest.ps1:88:13
Line |
  88 |              throw "Failed to confirm resources exist in Azure. Please …
     |              ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     | Failed to confirm resources exist in Azure. Please verify and try again.
ghost commented 1 year ago

Sorry, I mislabeled this. This should be be Issue-Bug.

RDMacLachlan commented 1 year ago

Thank you for the feedback.