Skip to content

Deployment fails if there are multiple CosmosDB accounts in the RG #233

Open
@aserfass-msft

Description

@aserfass-msft

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

Metadata

Metadata

Assignees

Labels

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions