microsoft / microsoft/winget-cli-restsource

Deployment fails if there are multiple CosmosDB accounts in the RG

Open
#233 1 comment 0 reactions 1 assignee View on GitHub

@RDMacLachlan is already working on this.

Since Apr 11, 2024.

Issue-Bug
Dominant language
C#
Stars
317
Forks
79
PR merge metrics
No merged PRs in 30d

Description

Brief description of your issue

While executing "New-WinGetSource", there is a bug if there are multiple CosmosDB accounts in the RG (like from multiple attempts to deploy a WinGetSource)

Steps to reproduce

This line throws an error (New-ARMObjects.ps1, line 80):
$CosmosAccountEndpointValue = ConvertTo-SecureString -String $($(Get-AzCosmosDBAccount -ResourceGroupName $AzResourceGroup).DocumentEndpoint) -AsPlainText -Force

If there are multiple attempts to create a WinGetSource in the RG, the above command returns multiple values for the Endpoint and ConcertTo-SecureString can't convert a list so it throw this error:
"ConvertTo-SecureString: Cannot convert 'System.Object[]' to the type 'System.String' required by parameter 'String'. Specified method is not supported."

Example: this command
$(Get-AzCosmosDBAccount -ResourceGroupName $AzResourceGroup).DocumentEndpoint

returns:
https://firstdeploymentname.documents.azure.com:443/
https://seconddeploymentname.documents.azure.com:443/

Expected behavior

The code should only be looking for the values from the current deployment rather than all deployments in the RG

Actual behavior

Deployment fails because too many values are returned when one was expected.

Environment
Windows Package Manager v1.7.10861
Copyright (c) Microsoft Corporation. All rights reserved.

Windows: Windows.Desktop v10.0.22631.3296
System Architecture: X64
Package: Microsoft.DesktopAppInstaller v1.22.10861.0

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.