diff --git a/Modules/VMware.vSphere.SsoAdmin/VMware.vSphere.SsoAdmin.psm1 b/Modules/VMware.vSphere.SsoAdmin/VMware.vSphere.SsoAdmin.psm1
index 385460a..4df050e 100644
--- a/Modules/VMware.vSphere.SsoAdmin/VMware.vSphere.SsoAdmin.psm1
+++ b/Modules/VMware.vSphere.SsoAdmin/VMware.vSphere.SsoAdmin.psm1
@@ -17,7 +17,7 @@ $PSModuleRoot = $PSModule.ModuleBase
$subModuleRoot = $PSModuleRoot
if (($PSVersionTable.Keys -contains "PSEdition") -and ($PSVersionTable.PSEdition -ne 'Desktop')) {
- $subModuleRoot = Join-Path -Path $PSModuleRoot -ChildPath 'netcoreapp2.0'
+ $subModuleRoot = Join-Path -Path $PSModuleRoot -ChildPath 'netcoreapp3.1'
}
else {
$subModuleRoot = Join-Path -Path $PSModuleRoot -ChildPath 'net45'
@@ -1365,7 +1365,7 @@ function Add-ExternalDomainIdentitySource {
-BaseDNGroups 'CN=Users,DC=sof-powercli,DC=vmware,DC=com' `
-Username 'sofPowercliAdmin' `
-Password '$up3R$Tr0Pa$$w0rD' `
- -ServerType 'OpenLDAP'
+ -ServerType 'ActiveDirectory'
Adds External Identity Source
#>
@@ -1445,7 +1445,7 @@ function Add-ExternalDomainIdentitySource {
ValueFromPipeline=$false,
ValueFromPipelineByPropertyName=$false,
HelpMessage='External domain server type')]
- [ValidateSet('ActiveDirectory','OpenLdap','NIS')]
+ [ValidateSet('ActiveDirectory')]
[string]
$DomainServerType = 'ActiveDirectory',
@@ -1521,17 +1521,17 @@ function Add-LDAPIdentitySource {
.PARAMETER Passowrd
Domain authentication password
-
+
.PARAMETER ServerType
Type of the ExternalDomain, one of 'ActiveDirectory','OpenLdap','NIS'
-
+
.PARAMETER Certificates
List of X509Certicate2 LDAP certificates
.PARAMETER Server
Specifies the vSphere Sso Admin Server on which you want to run the cmdlet.
If not specified the servers available in $global:DefaultSsoAdminServers variable will be used.
-
+
Adds LDAP Identity Source
#>
[CmdletBinding()]
@@ -1609,15 +1609,15 @@ function Add-LDAPIdentitySource {
ValueFromPipeline=$false,
ValueFromPipelineByPropertyName=$false,
HelpMessage='Ldap Server type')]
- [ValidateSet('ActiveDirectory','OpenLdap','NIS')]
+ [ValidateSet('ActiveDirectory')]
[string]
$ServerType,
-
+
[Parameter(
Mandatory=$false,
ValueFromPipeline=$false,
ValueFromPipelineByPropertyName=$false,
- HelpMessage='Ldap Certificates')]
+ HelpMessage='Ldap Certificates')]
[System.Security.Cryptography.X509Certificates.X509Certificate2[]]
$Certificates,
diff --git a/Modules/VMware.vSphere.SsoAdmin/net45/VMware.vSphere.LsClient.dll b/Modules/VMware.vSphere.SsoAdmin/net45/VMware.vSphere.LsClient.dll
index fc93bbc..281189a 100644
Binary files a/Modules/VMware.vSphere.SsoAdmin/net45/VMware.vSphere.LsClient.dll and b/Modules/VMware.vSphere.SsoAdmin/net45/VMware.vSphere.LsClient.dll differ
diff --git a/Modules/VMware.vSphere.SsoAdmin/net45/VMware.vSphere.SsoAdmin.Utils.dll b/Modules/VMware.vSphere.SsoAdmin/net45/VMware.vSphere.SsoAdmin.Utils.dll
index 67efcda..53f3069 100644
Binary files a/Modules/VMware.vSphere.SsoAdmin/net45/VMware.vSphere.SsoAdmin.Utils.dll and b/Modules/VMware.vSphere.SsoAdmin/net45/VMware.vSphere.SsoAdmin.Utils.dll differ
diff --git a/Modules/VMware.vSphere.SsoAdmin/net45/VMware.vSphere.SsoAdminClient.dll b/Modules/VMware.vSphere.SsoAdmin/net45/VMware.vSphere.SsoAdminClient.dll
index 153ba45..ab26cfe 100644
Binary files a/Modules/VMware.vSphere.SsoAdmin/net45/VMware.vSphere.SsoAdminClient.dll and b/Modules/VMware.vSphere.SsoAdmin/net45/VMware.vSphere.SsoAdminClient.dll differ
diff --git a/Modules/VMware.vSphere.SsoAdmin/netcoreapp2.0/VMware.vSphere.SsoAdminClient.dll b/Modules/VMware.vSphere.SsoAdmin/netcoreapp2.0/VMware.vSphere.SsoAdminClient.dll
deleted file mode 100644
index 2c88f10..0000000
Binary files a/Modules/VMware.vSphere.SsoAdmin/netcoreapp2.0/VMware.vSphere.SsoAdminClient.dll and /dev/null differ
diff --git a/Modules/VMware.vSphere.SsoAdmin/netcoreapp2.0/VMware.vSphere.LsClient.dll b/Modules/VMware.vSphere.SsoAdmin/netcoreapp3.1/VMware.vSphere.LsClient.dll
similarity index 100%
rename from Modules/VMware.vSphere.SsoAdmin/netcoreapp2.0/VMware.vSphere.LsClient.dll
rename to Modules/VMware.vSphere.SsoAdmin/netcoreapp3.1/VMware.vSphere.LsClient.dll
diff --git a/Modules/VMware.vSphere.SsoAdmin/netcoreapp2.0/VMware.vSphere.SsoAdmin.Format.ps1xml b/Modules/VMware.vSphere.SsoAdmin/netcoreapp3.1/VMware.vSphere.SsoAdmin.Format.ps1xml
similarity index 100%
rename from Modules/VMware.vSphere.SsoAdmin/netcoreapp2.0/VMware.vSphere.SsoAdmin.Format.ps1xml
rename to Modules/VMware.vSphere.SsoAdmin/netcoreapp3.1/VMware.vSphere.SsoAdmin.Format.ps1xml
diff --git a/Modules/VMware.vSphere.SsoAdmin/netcoreapp2.0/VMware.vSphere.SsoAdmin.Utils.dll b/Modules/VMware.vSphere.SsoAdmin/netcoreapp3.1/VMware.vSphere.SsoAdmin.Utils.dll
similarity index 95%
rename from Modules/VMware.vSphere.SsoAdmin/netcoreapp2.0/VMware.vSphere.SsoAdmin.Utils.dll
rename to Modules/VMware.vSphere.SsoAdmin/netcoreapp3.1/VMware.vSphere.SsoAdmin.Utils.dll
index 4117558..d2ea3c6 100644
Binary files a/Modules/VMware.vSphere.SsoAdmin/netcoreapp2.0/VMware.vSphere.SsoAdmin.Utils.dll and b/Modules/VMware.vSphere.SsoAdmin/netcoreapp3.1/VMware.vSphere.SsoAdmin.Utils.dll differ
diff --git a/Modules/VMware.vSphere.SsoAdmin/netcoreapp2.0/VMware.vSphere.SsoAdmin.psd1 b/Modules/VMware.vSphere.SsoAdmin/netcoreapp3.1/VMware.vSphere.SsoAdmin.psd1
similarity index 100%
rename from Modules/VMware.vSphere.SsoAdmin/netcoreapp2.0/VMware.vSphere.SsoAdmin.psd1
rename to Modules/VMware.vSphere.SsoAdmin/netcoreapp3.1/VMware.vSphere.SsoAdmin.psd1
diff --git a/Modules/VMware.vSphere.SsoAdmin/netcoreapp3.1/VMware.vSphere.SsoAdminClient.dll b/Modules/VMware.vSphere.SsoAdmin/netcoreapp3.1/VMware.vSphere.SsoAdminClient.dll
new file mode 100644
index 0000000..2218e45
Binary files /dev/null and b/Modules/VMware.vSphere.SsoAdmin/netcoreapp3.1/VMware.vSphere.SsoAdminClient.dll differ
diff --git a/Modules/VMware.vSphere.SsoAdmin/src/VMware.vSphere.SsoAdmin.Client/VMware.vSphere.LsClient/VMware.vSphere.LsClient.csproj b/Modules/VMware.vSphere.SsoAdmin/src/VMware.vSphere.SsoAdmin.Client/VMware.vSphere.LsClient/VMware.vSphere.LsClient.csproj
index 461bacf..b20cc22 100644
--- a/Modules/VMware.vSphere.SsoAdmin/src/VMware.vSphere.SsoAdmin.Client/VMware.vSphere.LsClient/VMware.vSphere.LsClient.csproj
+++ b/Modules/VMware.vSphere.SsoAdmin/src/VMware.vSphere.SsoAdmin.Client/VMware.vSphere.LsClient/VMware.vSphere.LsClient.csproj
@@ -4,7 +4,7 @@
VMware.vSphere.LsClient
VMware.vSphere.LsClient
vSphere Lookup Service API client.
- net45;netcoreapp2.0
+ net45;netcoreapp3.1
@@ -16,7 +16,7 @@
-
+
diff --git a/Modules/VMware.vSphere.SsoAdmin/src/VMware.vSphere.SsoAdmin.Client/VMware.vSphere.SsoAdmin.Utils/VMware.vSphere.SsoAdmin.Utils.csproj b/Modules/VMware.vSphere.SsoAdmin/src/VMware.vSphere.SsoAdmin.Client/VMware.vSphere.SsoAdmin.Utils/VMware.vSphere.SsoAdmin.Utils.csproj
index 9e947ce..28d3464 100644
--- a/Modules/VMware.vSphere.SsoAdmin/src/VMware.vSphere.SsoAdmin.Client/VMware.vSphere.SsoAdmin.Utils/VMware.vSphere.SsoAdmin.Utils.csproj
+++ b/Modules/VMware.vSphere.SsoAdmin/src/VMware.vSphere.SsoAdmin.Client/VMware.vSphere.SsoAdmin.Utils/VMware.vSphere.SsoAdmin.Utils.csproj
@@ -4,7 +4,7 @@
VMware.vSphere.SsoAdmin.Utils
VMware.vSphere.SsoAdmin.Utils
vSphere Lookup SsoAdmin utility types.
- net45;netcoreapp2.0
+ net45;netcoreapp3.1
@@ -17,7 +17,7 @@
-
+
diff --git a/Modules/VMware.vSphere.SsoAdmin/src/VMware.vSphere.SsoAdmin.Client/VMware.vSphere.SsoAdminClient/SsoAdminClient.cs b/Modules/VMware.vSphere.SsoAdmin/src/VMware.vSphere.SsoAdmin.Client/VMware.vSphere.SsoAdminClient/SsoAdminClient.cs
index 1a34d2e..ad4d30c 100644
--- a/Modules/VMware.vSphere.SsoAdmin/src/VMware.vSphere.SsoAdmin.Client/VMware.vSphere.SsoAdminClient/SsoAdminClient.cs
+++ b/Modules/VMware.vSphere.SsoAdmin/src/VMware.vSphere.SsoAdmin.Client/VMware.vSphere.SsoAdminClient/SsoAdminClient.cs
@@ -693,22 +693,26 @@ namespace VMware.vSphere.SsoAdminClient
}
}
- authorizedInvocationContext.
- InvokeOperation(() =>
- _ssoAdminBindingClient.RegisterLdapAsync(
- new ManagedObjectReference {
- type = "SsoAdminIdentitySourceManagementService",
- Value = "identitySourceManagementService"
- },
- serverType,
- domainName,
- domainAlias,
- adminLdapIdentitySourceDetails,
- authenticationType,
- new SsoAdminIdentitySourceManagementServiceAuthenticationCredentials {
- username = authenticationUserName,
- password = authenticationPassword
- })).Wait();
+ try {
+ authorizedInvocationContext.
+ InvokeOperation(() =>
+ _ssoAdminBindingClient.RegisterLdapAsync(
+ new ManagedObjectReference {
+ type = "SsoAdminIdentitySourceManagementService",
+ Value = "identitySourceManagementService"
+ },
+ serverType,
+ domainName,
+ domainAlias,
+ adminLdapIdentitySourceDetails,
+ authenticationType,
+ new SsoAdminIdentitySourceManagementServiceAuthenticationCredentials {
+ username = authenticationUserName,
+ password = authenticationPassword
+ })).Wait();
+ } catch (AggregateException e) {
+ throw e.InnerException;
+ }
}
public IEnumerable GetDomains() {
diff --git a/Modules/VMware.vSphere.SsoAdmin/src/VMware.vSphere.SsoAdmin.Client/VMware.vSphere.SsoAdminClient/VMware.vSphere.SsoAdminClient.csproj b/Modules/VMware.vSphere.SsoAdmin/src/VMware.vSphere.SsoAdmin.Client/VMware.vSphere.SsoAdminClient/VMware.vSphere.SsoAdminClient.csproj
index 6b1bb4f..c66f580 100644
--- a/Modules/VMware.vSphere.SsoAdmin/src/VMware.vSphere.SsoAdmin.Client/VMware.vSphere.SsoAdminClient/VMware.vSphere.SsoAdminClient.csproj
+++ b/Modules/VMware.vSphere.SsoAdmin/src/VMware.vSphere.SsoAdmin.Client/VMware.vSphere.SsoAdminClient/VMware.vSphere.SsoAdminClient.csproj
@@ -4,14 +4,14 @@
VMware.vSphere.SsoAdminClient
VMware.vSphere.SsoAdminClient
SSO Admin API client.
- net45;netcoreapp2.0
+ net45;netcoreapp3.1
$(DefineConstants);NET45
-
+
$(DefineConstants);NETCORE20
@@ -24,7 +24,7 @@
-
+
diff --git a/Modules/VMware.vSphere.SsoAdmin/src/build.ps1 b/Modules/VMware.vSphere.SsoAdmin/src/build.ps1
index 5b796bc..ae02368 100644
--- a/Modules/VMware.vSphere.SsoAdmin/src/build.ps1
+++ b/Modules/VMware.vSphere.SsoAdmin/src/build.ps1
@@ -98,7 +98,7 @@ param($OutputFolder)
"VMware.vSphere.SsoAdmin.Utils.dll")
- $netcoreTarget = Join-Path $OutputFolder "netcoreapp2.0"
+ $netcoreTarget = Join-Path $OutputFolder "netcoreapp3.1"
$net45Target = Join-Path $OutputFolder "net45"
Copy-Item -Path $netcoreLsSource -Destination $netcoreTarget -Force
diff --git a/Modules/VMware.vSphere.SsoAdmin/src/test/ConnectDisconnect.Tests.ps1 b/Modules/VMware.vSphere.SsoAdmin/src/test/ConnectDisconnect.Tests.ps1
index fd1fcfe..0658ac4 100644
--- a/Modules/VMware.vSphere.SsoAdmin/src/test/ConnectDisconnect.Tests.ps1
+++ b/Modules/VMware.vSphere.SsoAdmin/src/test/ConnectDisconnect.Tests.ps1
@@ -38,11 +38,11 @@ Describe "Connect-SsoAdminServer and Disconnect-SsoAdminServer Tests" {
-SkipCertificateCheck
# Assert
- $actual | Should Not Be $null
- $actual.GetType().FullName | Should Be 'VMware.vSphere.SsoAdminClient.DataTypes.SsoAdminServer'
- $actual.IsConnected | Should Be $true
- $actual.Name | Should Be $VcAddress
- $global:DefaultSsoAdminServers | Should Contain $actual
+ $actual | Should -Not -Be $null
+ $actual.GetType().FullName | Should -Be 'VMware.vSphere.SsoAdminClient.DataTypes.SsoAdminServer'
+ $actual.IsConnected | Should -Be $true
+ $actual.Name | Should -Be $VcAddress
+ $global:DefaultSsoAdminServers | Should -Contain $actual
}
It 'Connect-SsoAdminServer throws error on invalid password' {
@@ -82,8 +82,8 @@ Describe "Connect-SsoAdminServer and Disconnect-SsoAdminServer Tests" {
$expected | Disconnect-SsoAdminServer
# Assert
- $global:DefaultSsoAdminServers | Should Not Contain $expected
- $expected.IsConnected | Should Be $false
+ $global:DefaultSsoAdminServers | Should -Not -Contain $expected
+ $expected.IsConnected | Should -Be $false
}
It 'Diconnect-SsoAdminServer disconnects the currently connected SSO in case there is 1 SSO server' {
@@ -98,8 +98,8 @@ Describe "Connect-SsoAdminServer and Disconnect-SsoAdminServer Tests" {
Disconnect-SsoAdminServer -server $expected
# Assert
- $global:DefaultSsoAdminServers | Should Not Contain $expected
- $expected.IsConnected | Should Be $false
+ $global:DefaultSsoAdminServers | Should -Not -Contain $expected
+ $expected.IsConnected | Should -Be $false
}
It 'Diconnect-SsoAdminServer does not disconnect if connected to more than 1 SSO server' {
@@ -118,13 +118,13 @@ Describe "Connect-SsoAdminServer and Disconnect-SsoAdminServer Tests" {
# Act
# Assert
- $connection2 | Should Be $connection1
- $connection2.RefCount | Should Be 2
+ $connection2 | Should -Be $connection1
+ $connection2.RefCount | Should -Be 2
Disconnect-SsoAdminServer
$connection2.IsConnected | Should -Contain $true
- $connection2.RefCount | Should Be 1
+ $connection2.RefCount | Should -Be 1
}
It 'Diconnect-SsoAdminServer does disconnect via pipeline if connected to more than 1 SSO server' {
@@ -143,9 +143,9 @@ Describe "Connect-SsoAdminServer and Disconnect-SsoAdminServer Tests" {
# Act
$connection1, $connection2 | Disconnect-SsoAdminServer
# Assert
- $global:DefaultSsoAdminServers.Count | Should Be 0
- $connection1.IsConnected | Should Be $false
- $connection2.IsConnected | Should Be $false
+ $global:DefaultSsoAdminServers.Count | Should -Be 0
+ $connection1.IsConnected | Should -Be $false
+ $connection2.IsConnected | Should -Be $false
}
It 'Disconnects disconnected object' {
@@ -163,8 +163,8 @@ Describe "Connect-SsoAdminServer and Disconnect-SsoAdminServer Tests" {
Should Not Throw
# Assert
- $global:DefaultSsoAdminServers | Should Not Contain $expected
- $expected.IsConnected | Should Be $false
+ $global:DefaultSsoAdminServers | Should -Not -Contain $expected
+ $expected.IsConnected | Should -Be $false
}
It 'Disconnects DefaultSsoAdminServers when * is specified on -Server parameter' {
@@ -180,8 +180,8 @@ Describe "Connect-SsoAdminServer and Disconnect-SsoAdminServer Tests" {
# Assert
- $global:DefaultSsoAdminServers.Count | Should Be 0
- $expected.IsConnected | Should Be $false
+ $global:DefaultSsoAdminServers.Count | Should -Be 0
+ $expected.IsConnected | Should -Be $false
}
It 'Disconnects server specified as string that is equal to VC Address' {
@@ -197,8 +197,8 @@ Describe "Connect-SsoAdminServer and Disconnect-SsoAdminServer Tests" {
# Assert
- $global:DefaultSsoAdminServers.Count | Should Be 0
- $expected.IsConnected | Should Be $false
+ $global:DefaultSsoAdminServers.Count | Should -Be 0
+ $expected.IsConnected | Should -Be $false
}
It 'Disconnect-SsoAdminServer fails when string that does not match any servers is specified' {
@@ -210,13 +210,13 @@ Describe "Connect-SsoAdminServer and Disconnect-SsoAdminServer Tests" {
-SkipCertificateCheck
# Act
- { Disconnect-SsoAdminServer -Server "testserver" } | Should Throw
+ { Disconnect-SsoAdminServer -Server "testserver" } | Should -Throw
# Assert
- $global:DefaultSsoAdminServers.Count | Should Be 1
- $global:DefaultSsoAdminServers[0] | Should Be $expected
- $expected.IsConnected | Should Be $true
+ $global:DefaultSsoAdminServers.Count | Should -Be 1
+ $global:DefaultSsoAdminServers[0] | Should -Be $expected
+ $expected.IsConnected | Should -Be $true
# Cleanup
Disconnect-SsoAdminServer -Server $expected
diff --git a/Modules/VMware.vSphere.SsoAdmin/src/test/Group.Tests.ps1 b/Modules/VMware.vSphere.SsoAdmin/src/test/Group.Tests.ps1
index 42406e1..7eda354 100644
--- a/Modules/VMware.vSphere.SsoAdmin/src/test/Group.Tests.ps1
+++ b/Modules/VMware.vSphere.SsoAdmin/src/test/Group.Tests.ps1
@@ -42,10 +42,10 @@ Describe "Get-SsoGroup Tests" {
$actual = Get-SsoGroup
# Assert
- $actual | Should Not Be $null
- $actual.Count | Should BeGreaterThan 0
- $actual[0].Name | Should Not Be $null
- $actual[0].Domain | Should Be 'localos'
+ $actual | Should -Not -Be $null
+ $actual.Count | Should -BeGreaterThan 0
+ $actual[0].Name | Should -Not -Be $null
+ $actual[0].Domain | Should -Be 'localos'
}
It 'Gets groups for default domain' {
@@ -64,10 +64,10 @@ Describe "Get-SsoGroup Tests" {
-Domain $newPersonUser.Domain
# Assert
- $actual | Should Not Be $null
- $actual.Count | Should BeGreaterThan 0
- $actual[0].Name | Should Not Be $null
- $actual[0].Domain | Should Be $newPersonUser.Domain
+ $actual | Should -Not -Be $null
+ $actual.Count | Should -BeGreaterThan 0
+ $actual[0].Name | Should -Not -Be $null
+ $actual[0].Domain | Should -Be $newPersonUser.Domain
# Cleanup
Remove-SsoPersonUser -User $newPersonUser
diff --git a/Modules/VMware.vSphere.SsoAdmin/src/test/IdentitySource.Tests.ps1 b/Modules/VMware.vSphere.SsoAdmin/src/test/IdentitySource.Tests.ps1
index f0c1814..6b858a3 100644
--- a/Modules/VMware.vSphere.SsoAdmin/src/test/IdentitySource.Tests.ps1
+++ b/Modules/VMware.vSphere.SsoAdmin/src/test/IdentitySource.Tests.ps1
@@ -42,9 +42,9 @@ Describe "Get-IdentitySource Tests" {
$actual = Get-IdentitySource
# Assert
- $actual | Should Not Be $null
- $actual.Count | Should BeGreaterThan 1
- $actual[0].NAme | Should Be 'localos'
+ $actual | Should -Not -Be $null
+ $actual.Count | Should -BeGreaterThan 1
+ $actual[0].NAme | Should -Be 'localos'
}
It 'Gets localos only identity source' {
@@ -52,9 +52,9 @@ Describe "Get-IdentitySource Tests" {
$actual = Get-IdentitySource -Localos
# Assert
- $actual | Should Not Be $null
- $actual.Count | Should Be 1
- $actual[0].NAme | Should Be 'localos'
+ $actual | Should -Not -Be $null
+ $actual.Count | Should -Be 1
+ $actual[0].Name | Should -Be 'localos'
}
It 'Gets all available identity sources' {
@@ -62,10 +62,10 @@ Describe "Get-IdentitySource Tests" {
$actual = Get-IdentitySource -Localos -System
# Assert
- $actual | Should Not Be $null
- $actual.Count | Should Be 2
- $actual[0].Name | Should Be 'localos'
- $actual[0].Name | Should Not Be $null
+ $actual | Should -Not -Be $null
+ $actual.Count | Should -Be 2
+ $actual[0].Name | Should -Be 'localos'
+ $actual[0].Name | Should -Not -Be $null
}
}
}
\ No newline at end of file
diff --git a/Modules/VMware.vSphere.SsoAdmin/src/test/LockoutPolicy.Tests.ps1 b/Modules/VMware.vSphere.SsoAdmin/src/test/LockoutPolicy.Tests.ps1
index 10069c9..d96d4a9 100644
--- a/Modules/VMware.vSphere.SsoAdmin/src/test/LockoutPolicy.Tests.ps1
+++ b/Modules/VMware.vSphere.SsoAdmin/src/test/LockoutPolicy.Tests.ps1
@@ -42,7 +42,7 @@ Describe "LockoutPolicy Tests" {
$actual = Get-SsoLockoutPolicy
# Assert
- $actual | Should Not Be $null
+ $actual | Should -Not -Be $null
}
}
@@ -60,11 +60,11 @@ Describe "LockoutPolicy Tests" {
-MaxFailedAttempts $expectedMaxFailedAttempts
# Assert
- $actual | Should Not Be $null
- $actual.AutoUnlockIntervalSec | Should Be $expectedAutoUnlockIntervalSec
- $actual.MaxFailedAttempts | Should Be $expectedMaxFailedAttempts
- $actual.FailedAttemptIntervalSec | Should Be $lockoutPolicyToUpdate.FailedAttemptIntervalSec
- $actual.Description | Should Be $lockoutPolicyToUpdate.Description
+ $actual | Should -Not -Be $null
+ $actual.AutoUnlockIntervalSec | Should -Be $expectedAutoUnlockIntervalSec
+ $actual.MaxFailedAttempts | Should -Be $expectedMaxFailedAttempts
+ $actual.FailedAttemptIntervalSec | Should -Be $lockoutPolicyToUpdate.FailedAttemptIntervalSec
+ $actual.Description | Should -Be $lockoutPolicyToUpdate.Description
# Cleanup
$lockoutPolicyToUpdate | Set-SsoLockoutPolicy
diff --git a/Modules/VMware.vSphere.SsoAdmin/src/test/LsClient.Tests.ps1 b/Modules/VMware.vSphere.SsoAdmin/src/test/LsClient.Tests.ps1
index 05d2fff..edd8b69 100644
--- a/Modules/VMware.vSphere.SsoAdmin/src/test/LsClient.Tests.ps1
+++ b/Modules/VMware.vSphere.SsoAdmin/src/test/LsClient.Tests.ps1
@@ -40,8 +40,8 @@ Describe "Lookup Service Client Integration Tests" {
$actual = $script:lsClient.GetSsoAdminEndpointUri()
# Assert
- $actual | Should Not Be $null
- $actual.ToString().StartsWith("https://$VCAddress/sso-adminserver/sdk/") | Should Be $true
+ $actual | Should -Not -Be $null
+ $actual.ToString().StartsWith("https://$VCAddress/sso-adminserver/sdk/") | Should -Be $true
}
It 'Gets STS API Url' {
@@ -49,8 +49,8 @@ Describe "Lookup Service Client Integration Tests" {
$actual = $script:lsClient.GetStsEndpointUri()
# Assert
- $actual | Should Not Be $null
- $actual.ToString().StartsWith("https://$VCAddress/sts/STSService") | Should Be $true
+ $actual | Should -Not -Be $null
+ $actual.ToString().StartsWith("https://$VCAddress/sts/STSService") | Should -Be $true
}
}
}
\ No newline at end of file
diff --git a/Modules/VMware.vSphere.SsoAdmin/src/test/PasswordPolicy.Tests.ps1 b/Modules/VMware.vSphere.SsoAdmin/src/test/PasswordPolicy.Tests.ps1
index 2ff57d9..9c5ecc1 100644
--- a/Modules/VMware.vSphere.SsoAdmin/src/test/PasswordPolicy.Tests.ps1
+++ b/Modules/VMware.vSphere.SsoAdmin/src/test/PasswordPolicy.Tests.ps1
@@ -42,7 +42,7 @@ Describe "PasswordPolicy Tests" {
$actual = Get-SsoPasswordPolicy
# Assert
- $actual | Should Not Be $null
+ $actual | Should -Not -Be $null
}
}
@@ -60,18 +60,18 @@ Describe "PasswordPolicy Tests" {
-PasswordLifetimeDays $expectedPasswordLifetimeDays
# Assert
- $actual | Should Not Be $null
- $actual.MaxLength | Should Be $expectedMaxLength
- $actual.PasswordLifetimeDays | Should Be $expectedPasswordLifetimeDays
- $actual.Description | Should Be $passwordPolicyToUpdate.Description
- $actual.ProhibitedPreviousPasswordsCount | Should Be $passwordPolicyToUpdate.ProhibitedPreviousPasswordsCount
- $actual.MinLength | Should Be $passwordPolicyToUpdate.MinLength
- $actual.MaxIdenticalAdjacentCharacters | Should Be $passwordPolicyToUpdate.MaxIdenticalAdjacentCharacters
- $actual.MinNumericCount | Should Be $passwordPolicyToUpdate.MinNumericCount
- $actual.MinSpecialCharCount | Should Be $passwordPolicyToUpdate.MinSpecialCharCount
- $actual.MinAlphabeticCount | Should Be $passwordPolicyToUpdate.MinAlphabeticCount
- $actual.MinUppercaseCount | Should Be $passwordPolicyToUpdate.MinUppercaseCount
- $actual.MinLowercaseCount | Should Be $passwordPolicyToUpdate.MinLowercaseCount
+ $actual | Should -Not -Be $null
+ $actual.MaxLength | Should -Be $expectedMaxLength
+ $actual.PasswordLifetimeDays | Should -Be $expectedPasswordLifetimeDays
+ $actual.Description | Should -Be $passwordPolicyToUpdate.Description
+ $actual.ProhibitedPreviousPasswordsCount | Should -Be $passwordPolicyToUpdate.ProhibitedPreviousPasswordsCount
+ $actual.MinLength | Should -Be $passwordPolicyToUpdate.MinLength
+ $actual.MaxIdenticalAdjacentCharacters | Should -Be $passwordPolicyToUpdate.MaxIdenticalAdjacentCharacters
+ $actual.MinNumericCount | Should -Be $passwordPolicyToUpdate.MinNumericCount
+ $actual.MinSpecialCharCount | Should -Be $passwordPolicyToUpdate.MinSpecialCharCount
+ $actual.MinAlphabeticCount | Should -Be $passwordPolicyToUpdate.MinAlphabeticCount
+ $actual.MinUppercaseCount | Should -Be $passwordPolicyToUpdate.MinUppercaseCount
+ $actual.MinLowercaseCount | Should -Be $passwordPolicyToUpdate.MinLowercaseCount
# Cleanup
$passwordPolicyToUpdate | Set-SsoPasswordPolicy
@@ -89,18 +89,18 @@ Describe "PasswordPolicy Tests" {
-MinUppercaseCount $expectedMinUppercaseCount
# Assert
- $actual | Should Not Be $null
- $actual.Description | Should Be $expectedDescription
- $actual.MinUppercaseCount | Should Be $expectedMinUppercaseCount
- $actual.MaxLength | Should Be $passwordPolicyToUpdate.MaxLength
- $actual.PasswordLifetimeDays | Should Be $passwordPolicyToUpdate.PasswordLifetimeDays
- $actual.ProhibitedPreviousPasswordsCount | Should Be $passwordPolicyToUpdate.ProhibitedPreviousPasswordsCount
- $actual.MinLength | Should Be $passwordPolicyToUpdate.MinLength
- $actual.MaxIdenticalAdjacentCharacters | Should Be $passwordPolicyToUpdate.MaxIdenticalAdjacentCharacters
- $actual.MinNumericCount | Should Be $passwordPolicyToUpdate.MinNumericCount
- $actual.MinSpecialCharCount | Should Be $passwordPolicyToUpdate.MinSpecialCharCount
- $actual.MinAlphabeticCount | Should Be $passwordPolicyToUpdate.MinAlphabeticCount
- $actual.MinLowercaseCount | Should Be $passwordPolicyToUpdate.MinLowercaseCount
+ $actual | Should -Not -Be $null
+ $actual.Description | Should -Be $expectedDescription
+ $actual.MinUppercaseCount | Should -Be $expectedMinUppercaseCount
+ $actual.MaxLength | Should -Be $passwordPolicyToUpdate.MaxLength
+ $actual.PasswordLifetimeDays | Should -Be $passwordPolicyToUpdate.PasswordLifetimeDays
+ $actual.ProhibitedPreviousPasswordsCount | Should -Be $passwordPolicyToUpdate.ProhibitedPreviousPasswordsCount
+ $actual.MinLength | Should -Be $passwordPolicyToUpdate.MinLength
+ $actual.MaxIdenticalAdjacentCharacters | Should -Be $passwordPolicyToUpdate.MaxIdenticalAdjacentCharacters
+ $actual.MinNumericCount | Should -Be $passwordPolicyToUpdate.MinNumericCount
+ $actual.MinSpecialCharCount | Should -Be $passwordPolicyToUpdate.MinSpecialCharCount
+ $actual.MinAlphabeticCount | Should -Be $passwordPolicyToUpdate.MinAlphabeticCount
+ $actual.MinLowercaseCount | Should -Be $passwordPolicyToUpdate.MinLowercaseCount
# Cleanup
$passwordPolicyToUpdate | Set-SsoPasswordPolicy
diff --git a/Modules/VMware.vSphere.SsoAdmin/src/test/PersonUser.Tests.ps1 b/Modules/VMware.vSphere.SsoAdmin/src/test/PersonUser.Tests.ps1
index 485718b..6773aa8 100644
--- a/Modules/VMware.vSphere.SsoAdmin/src/test/PersonUser.Tests.ps1
+++ b/Modules/VMware.vSphere.SsoAdmin/src/test/PersonUser.Tests.ps1
@@ -63,14 +63,14 @@ Describe "PersonUser Tests" {
$script:usersToCleanup += $actual
# Assert
- $actual | Should Not Be $null
- $actual.GetType().FullName | Should Be 'VMware.vSphere.SsoAdminClient.DataTypes.PersonUser'
- $actual.Name | Should Be $expectedUserName
- $actual.Domain | Should Not Be $null
- $actual.Description | Should Be $expectedDescription
- $actual.FirstName | Should Be $expectedFirstName
- $actual.LastName | Should Be $expectedLastName
- $actual.EmailAddress | Should Be $expectedEmailAddress
+ $actual | Should -Not -Be $null
+ $actual.GetType().FullName | Should -Be 'VMware.vSphere.SsoAdminClient.DataTypes.PersonUser'
+ $actual.Name | Should -Be $expectedUserName
+ $actual.Domain | Should -Not -Be $null
+ $actual.Description | Should -Be $expectedDescription
+ $actual.FirstName | Should -Be $expectedFirstName
+ $actual.LastName | Should -Be $expectedLastName
+ $actual.EmailAddress | Should -Be $expectedEmailAddress
}
It 'Creates person user without details' {
@@ -92,14 +92,14 @@ Describe "PersonUser Tests" {
$script:usersToCleanup += $actual
# Assert
- $actual | Should Not Be $null
- $actual.GetType().FullName | Should Be 'VMware.vSphere.SsoAdminClient.DataTypes.PersonUser'
- $actual.Name | Should Be $expectedUserName
- $actual.Domain | Should Not Be $null
- $actual.Description | Should Be $null
- $actual.FirstName | Should Be $null
- $actual.LastName | Should Be $null
- $actual.EmailAddress | Should Be $null
+ $actual | Should -Not -Be $null
+ $actual.GetType().FullName | Should -Be 'VMware.vSphere.SsoAdminClient.DataTypes.PersonUser'
+ $actual.Name | Should -Be $expectedUserName
+ $actual.Domain | Should -Not -Be $null
+ $actual.Description | Should -Be $null
+ $actual.FirstName | Should -Be $null
+ $actual.LastName | Should -Be $null
+ $actual.EmailAddress | Should -Be $null
}
}
@@ -116,10 +116,10 @@ Describe "PersonUser Tests" {
$actual = Get-SsoPersonUser
# Assert
- $actual | Should Not Be $null
- $actual.Count | Should BeGreaterThan 0
- $actual[0].Name | Should Not Be $null
- $actual[0].Domain | Should Be 'localos'
+ $actual | Should -Not -Be $null
+ $actual.Count | Should -BeGreaterThan 0
+ $actual[0].Name | Should -Not -Be $null
+ $actual[0].Domain | Should -Be 'localos'
}
It 'Gets person users by name (exact match) and domain filters' {
@@ -153,10 +153,10 @@ Describe "PersonUser Tests" {
-Server $connection
# Assert
- $actual | Should Not Be $null
- $actual.Name | Should Be $expectedUserName
- $actual.Domain | Should Not Be $null
- $actual.Domain | Should Be $personUserToSearch.Domain
+ $actual | Should -Not -Be $null
+ $actual.Name | Should -Be $expectedUserName
+ $actual.Domain | Should -Not -Be $null
+ $actual.Domain | Should -Be $personUserToSearch.Domain
}
It 'Gets person users by name (* wildcard match) and domain filters' {
@@ -190,10 +190,10 @@ Describe "PersonUser Tests" {
-Server $connection
# Assert
- $actual | Should Not Be $null
- $actual.Count | Should Be 2
- $actual.Name | Should Contain $expectedUserName
- $actual.Name | Should Contain $secondUserName
+ $actual | Should -Not -Be $null
+ $actual.Count | Should -Be 2
+ $actual.Name | Should -Contain $expectedUserName
+ $actual.Name | Should -Contain $secondUserName
}
It 'Gets person users by name (? wildcard match) and domain filters' {
@@ -227,10 +227,10 @@ Describe "PersonUser Tests" {
-Server $connection
# Assert
- $actual | Should Not Be $null
- $actual.Count | Should Be 2
- $actual.Name | Should Contain $expectedUserName
- $actual.Name | Should Contain $secondUserName
+ $actual | Should -Not -Be $null
+ $actual.Count | Should -Be 2
+ $actual.Name | Should -Contain $expectedUserName
+ $actual.Name | Should -Contain $secondUserName
}
It 'Gets person users by unexisting name does not return' {
@@ -258,7 +258,7 @@ Describe "PersonUser Tests" {
-Server $connection
# Assert
- $actual | Should Be $null
+ $actual | Should -Be $null
}
}
@@ -292,7 +292,7 @@ Describe "PersonUser Tests" {
-Add
# Assert
- $actual | Should Not Be $null
+ $actual | Should -Not -Be $null
}
It 'Removes person user from group' {
@@ -329,7 +329,7 @@ Describe "PersonUser Tests" {
-Remove
# Assert
- $actual | Should Not Be $null
+ $actual | Should -Not -Be $null
}
It 'Resets person user password' {
@@ -356,7 +356,7 @@ Describe "PersonUser Tests" {
-NewPassword $newPassword
# Assert
- $actual | Should Not Be $null
+ $actual | Should -Not -Be $null
}
It 'Unlocks not locked person user' {
@@ -382,7 +382,7 @@ Describe "PersonUser Tests" {
-Unlock
# Assert
- $actual | Should Be $null
+ $actual | Should -Be $null
}
}
@@ -407,12 +407,12 @@ Describe "PersonUser Tests" {
Remove-SsoPersonUser -User $personUserToRemove
# Assert
- $personUserToRemove | Should Not Be $null
+ $personUserToRemove | Should -Not -Be $null
$userFromServer = Get-SsoPersonUser `
-Name $personUserToRemove.Name `
-Domain $personUserToRemove.Domain `
-Server $connection
- $userFromServer | Should Be $null
+ $userFromServer | Should -Be $null
}
}
}
\ No newline at end of file
diff --git a/Modules/VMware.vSphere.SsoAdmin/src/test/RunTests.ps1 b/Modules/VMware.vSphere.SsoAdmin/src/test/RunTests.ps1
index a6bff25..cf996a0 100644
--- a/Modules/VMware.vSphere.SsoAdmin/src/test/RunTests.ps1
+++ b/Modules/VMware.vSphere.SsoAdmin/src/test/RunTests.ps1
@@ -17,20 +17,35 @@ param(
)
function Test-PesterIsAvailable() {
- $pesterModule = Get-Module Pester -List
- if ($pesterModule -eq $null) {
- throw "Pester Module is not available"
+ $pesterModules = Get-Module Pester -ListAvailable
+ $pesterModule = $null
+ # Search for Pester 4.X
+ foreach ($p in $pesterModules) {
+ if ($p.Version -ge [version]"5.0.0") {
+ $pesterModule = $p
+ break
+ }
}
+
+ if ($pesterModule -eq $null) {
+ throw "Pester Module version 5.X is not available"
+ }
+
+ Import-Module -Name $pesterModule.Name -RequiredVersion $pesterModule.RequiredVersion
}
Test-PesterIsAvailable
-Invoke-Pester `
- -Script @{
- Path = $PSScriptRoot
- Parameters = @{
- VcAddress = $VcAddress
- User = $User
- Password = $Password
- }
- }
\ No newline at end of file
+$testsData = @{
+ VcAddress = $VcAddress
+ User = $User
+ Password = $Password
+}
+
+$pesterContainer = New-PesterContainer -Path $PSScriptRoot -Data $testsData
+$pesterConfiguration = [PesterConfiguration]::Default
+
+$pesterConfiguration.Run.Path = $PSScriptRoot
+$pesterConfiguration.Run.Container = $pesterContainer
+
+Invoke-Pester -Configuration $pesterConfiguration
\ No newline at end of file
diff --git a/Modules/VMware.vSphere.SsoAdmin/src/test/TokenLifetime.Tests.ps1 b/Modules/VMware.vSphere.SsoAdmin/src/test/TokenLifetime.Tests.ps1
index 0b3f5eb..843534e 100644
--- a/Modules/VMware.vSphere.SsoAdmin/src/test/TokenLifetime.Tests.ps1
+++ b/Modules/VMware.vSphere.SsoAdmin/src/test/TokenLifetime.Tests.ps1
@@ -42,9 +42,9 @@ Describe "TokenLifetime Tests" {
$actual = Get-SsoTokenLifetime
# Assert
- $actual | Should Not Be $null
- $actual.MaxHoKTokenLifetime | Should BeGreaterThan 0
- $actual.MaxBearerTokenLifetime | Should BeGreaterThan 0
+ $actual | Should -Not -Be $null
+ $actual.MaxHoKTokenLifetime | Should -BeGreaterThan 0
+ $actual.MaxBearerTokenLifetime | Should -BeGreaterThan 0
}
}
@@ -62,9 +62,9 @@ Describe "TokenLifetime Tests" {
-MaxBearerTokenLifetime $expectedMaxBearerTokenLifetime
# Assert
- $actual | Should Not Be $null
- $actual.MaxHoKTokenLifetime | Should Be $expectedMaxHoKTokenLifetime
- $actual.MaxBearerTokenLifetime | Should Be $expectedMaxBearerTokenLifetime
+ $actual | Should -Not -Be $null
+ $actual.MaxHoKTokenLifetime | Should -Be $expectedMaxHoKTokenLifetime
+ $actual.MaxBearerTokenLifetime | Should -Be $expectedMaxBearerTokenLifetime
# Cleanup
$tokenLifetimeToUpdate | Set-SsoTokenLifetime `