Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for Azure Government URI #322

Closed
Cj-Scott opened this issue Feb 27, 2020 · 6 comments
Closed

Add support for Azure Government URI #322

Cj-Scott opened this issue Feb 27, 2020 · 6 comments
Labels
enhancement The issue is an enhancement request. in progress The issue is being actively worked on by someone.

Comments

@Cj-Scott
Copy link

Issue

Please add parameterized support for Base URI 👍
documents.zure.us

https://docs.microsoft.com/en-us/azure/azure-government/documentation-government-services-database

@PlagueHO PlagueHO added enhancement The issue is an enhancement request. in progress The issue is being actively worked on by someone. labels Feb 28, 2020
@PlagueHO
Copy link
Owner

Hi @Cj-Scott - great suggestion. Should be easy enough to add to New-CosmosDbContext. Integration testing might not be possible, but unit testing will be easy. I'll try and get done this weekend.

@PlagueHO
Copy link
Owner

This has been completed in #346 and will be released in 3.7.0 shortly.

@LenaVinogradov
Copy link

@PlagueHO , we are using CosmosDB 2.1.15.239 version and cannot currently upgrade to 3.7.0.
Is there any workaround for us to use in our deployment to AzureUSGovernment? thank you.

@PlagueHO
Copy link
Owner

Hi @LenaVinogradov ,

It depends on how you are calling New-CosmosDbContext. If you are passing in the Account details (including Master Key) then you should be able to override the .BaseUri parameter in the $Context object returned by the New-CosmosDbContext command to be the URI required for US Govt accounts.

E.g.

$primaryKey = ConvertTo-SecureString -String 'GFJqJesi2Rq910E0G7P4WoZkzowzbj23Sm9DUWFX0l0P8o16mYyuaZBN00Nbtj9F1QQnumzZKSGZwknXGERrlA==' -AsPlainText -Force
$cosmosDbContext = New-CosmosDbContext -Account 'MyAzureCosmosDB' -Database 'MyDatabase' -Key $primaryKey
$cosmosDbContext.BaseUri = 'https://MyAzureCosmosDB.documents.azure.us'

However, any of the *-CosmosDbAccount functions won't work because they call out to the *-AzureRmCosmosDb cmdlets which require passing through specific flags for using the US Govt portal APIs.

Does that help?

@LenaVinogradov
Copy link

LenaVinogradov commented Apr 21, 2020 via email

@LenaVinogradov
Copy link

@PlagueHO ,
quick update:
I looked at the sources of what PS command is doing more closely. Updated the baseUrl I am passing to have trailing slash:
$context.BaseUri = "$($ondSettings.static.documentDBAccount.uri)/"
That seems to help. I was able to execute the rest of my script in the Azure Gov.
thanks !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement The issue is an enhancement request. in progress The issue is being actively worked on by someone.
Projects
None yet
Development

No branches or pull requests

3 participants