Skip to content

Commit

Permalink
updated to align w/ AADAuthenticationFactory beta
Browse files Browse the repository at this point in the history
  • Loading branch information
jformacek committed Jul 31, 2023
1 parent 79db87f commit df23d69
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/Publish-CosmosLite.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ jobs:
- name: Install prerequisites
shell: pwsh
run: |
Install-Module AadAuthenticationFactory -Force -Scope CurrentUser
Install-Module AadAuthenticationFactory -AllowPrerelease -Force -Scope CurrentUser
- name: Publish
#Publish to PS Gallery
Expand Down
11 changes: 6 additions & 5 deletions Commands/Public/Connect-Cosmos.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -95,10 +95,11 @@ function Connect-Cosmos
$ResourceOwnerCredential,

[Parameter()]
[ValidateSet('AzurePublic', 'AzureGermany', 'AzureChina','AzureUsGovernment','None')]
[string]
#AAD auth endpoint
#Default: endpoint for public cloud
$LoginApi = 'https://login.microsoftonline.com',
$AzureCloudInstance = 'AzurePublic',

[Parameter(Mandatory, ParameterSetName = 'PublicClient')]
[ValidateSet('Interactive', 'DeviceCode')]
Expand Down Expand Up @@ -156,15 +157,15 @@ function Connect-Cosmos
switch($PSCmdlet.ParameterSetName)
{
'PublicClient' {
$script:AuthFactories[$AccountName] = New-AadAuthenticationFactory -TenantId $TenantId -ClientId $ClientId -RequiredScopes $RequiredScopes -LoginApi $LoginApi -AuthMode $AuthMode -UserNameHint $UserNameHint
$script:AuthFactories[$AccountName] = New-AadAuthenticationFactory -TenantId $TenantId -ClientId $ClientId -RequiredScopes $RequiredScopes -AzureCloudInstance $AzureCloudInstance -AuthMode $AuthMode -UserNameHint $UserNameHint
break;
}
'ConfidentialClientWithSecret' {
$script:AuthFactories[$AccountName] = New-AadAuthenticationFactory -TenantId $TenantId -ClientId $ClientId -ClientSecret $clientSecret -RequiredScopes $RequiredScopes -LoginApi $LoginApi
$script:AuthFactories[$AccountName] = New-AadAuthenticationFactory -TenantId $TenantId -ClientId $ClientId -ClientSecret $clientSecret -RequiredScopes $RequiredScopes -AzureCloudInstance $AzureCloudInstance
break;
}
'ConfidentialClientWithCertificate' {
$script:AuthFactories[$AccountName] = New-AadAuthenticationFactory -TenantId $TenantId -ClientId $ClientId -X509Certificate $X509Certificate -RequiredScopes $RequiredScopes -LoginApi $LoginApi
$script:AuthFactories[$AccountName] = New-AadAuthenticationFactory -TenantId $TenantId -ClientId $ClientId -X509Certificate $X509Certificate -RequiredScopes $RequiredScopes -AzureCloudInstance $AzureCloudInstance
break;
}
'MSI' {
Expand All @@ -180,7 +181,7 @@ function Connect-Cosmos
break;
}
'ResourceOwnerPasssword' {
$script:AuthFactories[$AccountName] = New-AadAuthenticationFactory -TenantId $TenantId -ClientId $ClientId -ClientSecret $clientSecret -RequiredScopes $RequiredScopes -LoginApi $LoginApi -ResourceOwnerCredential $ResourceOwnerCredential
$script:AuthFactories[$AccountName] = New-AadAuthenticationFactory -TenantId $TenantId -ClientId $ClientId -ClientSecret $clientSecret -RequiredScopes $RequiredScopes -AzureCloudInstance $AzureCloudInstance -ResourceOwnerCredential $ResourceOwnerCredential
break;
}
}
Expand Down
Binary file modified Module/CosmosLite/CosmosLite.psd1
Binary file not shown.

0 comments on commit df23d69

Please sign in to comment.