PowerShell Module for working with Azure Cosmos DB databases, collections, documents, attachments, offers, users, permissions, triggers, stored procedures and user defined functions.
I have just downloaded the latest version from the gallery today and when creating a new context the default value that gets assigned to the context is 'AzureChinaCloud'. Even I try overriding by specifying the Environment parameter.
ModuleType Version PreRelease Name
---------- ------- ---------- ----
Script 4.4.3 CosmosDB
Name Value
---- -----
PSVersion 7.1.0-rc.2
PSEdition Core
GitCommitId 7.1.0-rc.2
OS Darwin 20.3.0 Darwin Kernel Version 20.3.0: Thu Jan 21 00:07:06 PST 2021; root:xnu-7195.81.3~1/RELEASE_X86_64
Platform Unix
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
WSManStackVersion 3.0
I tried debugging execution but it looks to be setting the value correctly to AzureCloud so not sure how it's ending up as AzureChinaCloud in the returned object.
Not sure if that's the cause or not. Will try and debug some more over the weekend to find out. Unfortunately the class object is not visible in the debugger when stepping through the code.
It looks like it's just not setting the value before returning the Context object. Is an easy fix and I'll correct it now. Unit tests should also pick this up in future.
I have just downloaded the latest version from the gallery today and when creating a new context the default value that gets assigned to the context is 'AzureChinaCloud'. Even I try overriding by specifying the Environment parameter.
Result:
Environment:
I tried debugging execution but it looks to be setting the value correctly to AzureCloud so not sure how it's ending up as AzureChinaCloud in the returned object.
It hits the
Account
value in the switch here: https://github.com/PlagueHO/CosmosDB/blob/main/source/Public/utils/New-CosmosDbContext.ps1#L166-L169Even inside the
Get-CosmosDbUri
function,$environment
is showingAzureCloud
I can see that there is no Environment being passed into the context object here:
https://github.com/PlagueHO/CosmosDB/blob/main/source/Public/utils/New-CosmosDbContext.ps1#L184-L192
Not sure if that's the cause or not. Will try and debug some more over the weekend to find out. Unfortunately the class object is not visible in the debugger when stepping through the code.