Rename module's exported functions with Sso prefix on the noun part

This commit is contained in:
dmilov
2020-10-05 10:48:36 +03:00
parent 68e777357c
commit b2934bcbf1
7 changed files with 88 additions and 88 deletions

View File

@@ -34,7 +34,7 @@ RequiredModules = @(
)
# Functions to export from this module
FunctionsToExport = @('Connect-SsoAdminServer', 'Disconnect-SsoAdminServer', 'New-PersonUser', 'Get-PersonUser', 'Set-PersonUser', 'Remove-PersonUser', 'Get-Group', 'Get-PasswordPolicy', 'Set-PasswordPolicy', 'Get-LockoutPolicy', 'Set-LockoutPolicy', 'Get-TokenLifetime', 'Set-TokenLifetime', 'Add-ActiveDirectoryIdentitySource')
FunctionsToExport = @('Connect-SsoAdminServer', 'Disconnect-SsoAdminServer', 'New-SsoPersonUser', 'Get-SsoPersonUser', 'Set-SsoPersonUser', 'Remove-SsoPersonUser', 'Get-SsoGroup', 'Get-SsoPasswordPolicy', 'Set-SsoPasswordPolicy', 'Get-SsoLockoutPolicy', 'Set-SsoLockoutPolicy', 'Get-SsoTokenLifetime', 'Set-SsoTokenLifetime', 'Add-ActiveDirectoryIdentitySource')
# Cmdlets to export from this module
CmdletsToExport = @()

View File

@@ -191,7 +191,7 @@ function Disconnect-SsoAdminServer {
#endregion
#region Person User Management
function New-PersonUser {
function New-SsoPersonUser {
<#
.NOTES
===========================================================================
@@ -227,12 +227,12 @@ function New-PersonUser {
.EXAMPLE
$ssoAdminConnection = Connect-SsoAdminServer -Server my.vc.server -User ssoAdmin@vsphere.local -Password 'ssoAdminStrongPa$$w0rd'
New-PersonUser -Server $ssoAdminConnection -User myAdmin -Password 'MyStrongPa$$w0rd'
New-SsoPersonUser -Server $ssoAdminConnection -User myAdmin -Password 'MyStrongPa$$w0rd'
Creates person user account with user name 'myAdmin' and password 'MyStrongPa$$w0rd'
.EXAMPLE
New-PersonUser -User myAdmin -Password 'MyStrongPa$$w0rd' -EmailAddress 'myAdmin@mydomain.com' -FirstName 'My' -LastName 'Admin'
New-SsoPersonUser -User myAdmin -Password 'MyStrongPa$$w0rd' -EmailAddress 'myAdmin@mydomain.com' -FirstName 'My' -LastName 'Admin'
Creates person user account with user name 'myAdmin', password 'MyStrongPa$$w0rd', and details against connections available in 'DefaultSsoAdminServers'
#>
@@ -320,7 +320,7 @@ function New-PersonUser {
}
}
function Get-PersonUser {
function Get-SsoPersonUser {
<#
.NOTES
===========================================================================
@@ -344,7 +344,7 @@ function Get-PersonUser {
If not specified the servers available in $global:DefaultSsoAdminServers variable will be used.
.EXAMPLE
Get-PersonUser -Name admin -Domain vsphere.local
Get-SsoPersonUser -Name admin -Domain vsphere.local
Gets person user accounts which contain name 'admin' in 'vsphere.local' domain
#>
@@ -413,7 +413,7 @@ function Get-PersonUser {
}
}
function Set-PersonUser {
function Set-SsoPersonUser {
<#
.NOTES
===========================================================================
@@ -444,22 +444,22 @@ function Set-PersonUser {
Specifies new password for the specified user.
.EXAMPLE
Set-PersonUser -User $myPersonUser -Group $myExampleGroup -Add -Server $ssoAdminConnection
Set-SsoPersonUser -User $myPersonUser -Group $myExampleGroup -Add -Server $ssoAdminConnection
Adds $myPersonUser to $myExampleGroup
.EXAMPLE
Set-PersonUser -User $myPersonUser -Group $myExampleGroup -Remove -Server $ssoAdminConnection
Set-SsoPersonUser -User $myPersonUser -Group $myExampleGroup -Remove -Server $ssoAdminConnection
Removes $myPersonUser from $myExampleGroup
.EXAMPLE
Set-PersonUser -User $myPersonUser -Unlock -Server $ssoAdminConnection
Set-SsoPersonUser -User $myPersonUser -Unlock -Server $ssoAdminConnection
Unlocks $myPersonUser
.EXAMPLE
Set-PersonUser -User $myPersonUser -NewPassword 'MyBrandNewPa$$W0RD' -Server $ssoAdminConnection
Set-SsoPersonUser -User $myPersonUser -NewPassword 'MyBrandNewPa$$W0RD' -Server $ssoAdminConnection
Resets $myPersonUser password
#>
@@ -553,7 +553,7 @@ function Set-PersonUser {
}
}
function Remove-PersonUser {
function Remove-SsoPersonUser {
<#
.NOTES
===========================================================================
@@ -570,8 +570,8 @@ function Remove-PersonUser {
.EXAMPLE
$ssoAdminConnection = Connect-SsoAdminServer -Server my.vc.server -User ssoAdmin@vsphere.local -Password 'ssoAdminStrongPa$$w0rd'
$myNewPersonUser = New-PersonUser -Server $ssoAdminConnection -User myAdmin -Password 'MyStrongPa$$w0rd'
Remove-PersonUser -User $myNewPersonUser
$myNewPersonUser = New-SsoPersonUser -Server $ssoAdminConnection -User myAdmin -Password 'MyStrongPa$$w0rd'
Remove-SsoPersonUser -User $myNewPersonUser
Remove person user account with user name 'myAdmin'
#>
@@ -600,7 +600,7 @@ function Remove-PersonUser {
#endregion
#region Group cmdlets
function Get-Group {
function Get-SsoGroup {
<#
.NOTES
===========================================================================
@@ -624,7 +624,7 @@ function Get-Group {
If not specified the servers available in $global:DefaultSsoAdminServers variable will be used.
.EXAMPLE
Get-Group -Name administrators -Domain vsphere.local
Get-SsoGroup -Name administrators -Domain vsphere.local
Gets 'adminsitrators' group in 'vsphere.local' domain
#>
@@ -695,7 +695,7 @@ function Get-Group {
#endregion
#region PasswordPolicy cmdlets
function Get-PasswordPolicy {
function Get-SsoPasswordPolicy {
<#
.NOTES
===========================================================================
@@ -712,7 +712,7 @@ function Get-PasswordPolicy {
If not specified the servers available in $global:DefaultSsoAdminServers variable will be used.
.EXAMPLE
Get-PasswordPolicy
Get-SsoPasswordPolicy
Gets password policy for the server connections available in $global:defaultSsoAdminServers
#>
@@ -743,7 +743,7 @@ function Get-PasswordPolicy {
}
}
function Set-PasswordPolicy {
function Set-SsoPasswordPolicy {
<#
.NOTES
===========================================================================
@@ -781,7 +781,7 @@ function Set-PasswordPolicy {
.PARAMETER PasswordLifetimeDays
.EXAMPLE
Get-PasswordPolicy | Set-PasswordPolicy -MinLength 10 -PasswordLifetimeDays 45
Get-SsoPasswordPolicy | Set-SsoPasswordPolicy -MinLength 10 -PasswordLifetimeDays 45
Updates password policy setting minimum password length to 10 symbols and password lifetime to 45 days
#>
@@ -945,7 +945,7 @@ function Set-PasswordPolicy {
#endregion
#region LockoutPolicy cmdlets
function Get-LockoutPolicy {
function Get-SsoLockoutPolicy {
<#
.NOTES
===========================================================================
@@ -962,7 +962,7 @@ function Get-LockoutPolicy {
If not specified the servers available in $global:DefaultSsoAdminServers variable will be used.
.EXAMPLE
Get-LockoutPolicy
Get-SsoLockoutPolicy
Gets lockout policy for the server connections available in $global:defaultSsoAdminServers
#>
@@ -993,7 +993,7 @@ function Get-LockoutPolicy {
}
}
function Set-LockoutPolicy {
function Set-SsoLockoutPolicy {
<#
.NOTES
===========================================================================
@@ -1017,7 +1017,7 @@ function Set-LockoutPolicy {
.PARAMETER MaxFailedAttempts
.EXAMPLE
Get-LockoutPolicy | Set-LockoutPolicy -AutoUnlockIntervalSec 15 -MaxFailedAttempts 4
Get-SsoLockoutPolicy | Set-SsoLockoutPolicy -AutoUnlockIntervalSec 15 -MaxFailedAttempts 4
Updates lockout policy auto unlock interval seconds and maximum failed attempts
#>
@@ -1097,7 +1097,7 @@ function Set-LockoutPolicy {
#endregion
#region TokenLifetime cmdlets
function Get-TokenLifetime {
function Get-SsoTokenLifetime {
<#
.NOTES
===========================================================================
@@ -1114,7 +1114,7 @@ function Get-TokenLifetime {
If not specified the servers available in $global:DefaultSsoAdminServers variable will be used.
.EXAMPLE
Get-TokenLifetime
Get-SsoTokenLifetime
Gets HoK and Bearer Token lifetime settings for the server connections available in $global:defaultSsoAdminServers
#>
@@ -1145,7 +1145,7 @@ function Get-TokenLifetime {
}
}
function Set-TokenLifetime {
function Set-SsoTokenLifetime {
<#
.NOTES
===========================================================================
@@ -1165,7 +1165,7 @@ function Set-TokenLifetime {
.PARAMETER MaxBearerTokenLifetime
.EXAMPLE
Get-TokenLifetime | Set-TokenLifetime -MaxHoKTokenLifetime 60
Get-SsoTokenLifetime | Set-SsoTokenLifetime -MaxHoKTokenLifetime 60
Updates HoK token lifetime setting
#>

View File

@@ -20,7 +20,7 @@ param(
$modulePath = Join-Path (Split-Path $PSScriptRoot | Split-Path) "VMware.vSphere.SsoAdmin.psd1"
Import-Module $modulePath
Describe "Get-Group Tests" {
Describe "Get-SsoGroup Tests" {
BeforeEach {
Connect-SsoAdminServer `
-Server $VcAddress `
@@ -36,10 +36,10 @@ Describe "Get-Group Tests" {
}
}
Context "Get-Group" {
Context "Get-SsoGroup" {
It 'Gets groups without filters' {
# Act
$actual = Get-Group
$actual = Get-SsoGroup
# Assert
$actual | Should Not Be $null
@@ -55,12 +55,12 @@ Describe "Get-Group Tests" {
## Create Person User to determine default domain name
## Person Users are created in the default domain
$newPersonUser = New-PersonUser `
$newPersonUser = New-SsoPersonUser `
-UserName $newUserName `
-Password $password
# Act
$actual = Get-Group `
$actual = Get-SsoGroup `
-Domain $newPersonUser.Domain
# Assert
@@ -70,7 +70,7 @@ Describe "Get-Group Tests" {
$actual[0].Domain | Should Be $newPersonUser.Domain
# Cleanup
Remove-PersonUser -User $newPersonUser
Remove-SsoPersonUser -User $newPersonUser
}
}
}

View File

@@ -36,25 +36,25 @@ Describe "LockoutPolicy Tests" {
}
}
Context "Get-LockoutPolicy" {
Context "Get-SsoLockoutPolicy" {
It 'Gets lockout policy' {
# Act
$actual = Get-LockoutPolicy
$actual = Get-SsoLockoutPolicy
# Assert
$actual | Should Not Be $null
}
}
Context "Set-LockoutPolicy" {
Context "Set-SsoLockoutPolicy" {
It 'Updates lockout policy AutoUnlockIntervalSec and MaxFailedAttempts' {
# Arrange
$lockoutPolicyToUpdate = Get-LockoutPolicy
$lockoutPolicyToUpdate = Get-SsoLockoutPolicy
$expectedAutoUnlockIntervalSec = 33
$expectedMaxFailedAttempts = 7
# Act
$actual = Set-LockoutPolicy `
$actual = Set-SsoLockoutPolicy `
-LockoutPolicy $lockoutPolicyToUpdate `
-AutoUnlockIntervalSec $expectedAutoUnlockIntervalSec `
-MaxFailedAttempts $expectedMaxFailedAttempts
@@ -67,7 +67,7 @@ Describe "LockoutPolicy Tests" {
$actual.Description | Should Be $lockoutPolicyToUpdate.Description
# Cleanup
$lockoutPolicyToUpdate | Set-LockoutPolicy
$lockoutPolicyToUpdate | Set-SsoLockoutPolicy
}
}
}

View File

@@ -36,25 +36,25 @@ Describe "PasswordPolicy Tests" {
}
}
Context "Get-PasswordPolicy" {
Context "Get-SsoPasswordPolicy" {
It 'Gets password policy' {
# Act
$actual = Get-PasswordPolicy
$actual = Get-SsoPasswordPolicy
# Assert
$actual | Should Not Be $null
}
}
Context "Set-PasswordPolicy" {
Context "Set-SsoPasswordPolicy" {
It 'Updates password policy MaxLength and PasswordLifetimeDays' {
# Arrange
$passwordPolicyToUpdate = Get-PasswordPolicy
$passwordPolicyToUpdate = Get-SsoPasswordPolicy
$expectedMaxLength = 17
$expectedPasswordLifetimeDays = 77
# Act
$actual = Set-PasswordPolicy `
$actual = Set-SsoPasswordPolicy `
-PasswordPolicy $passwordPolicyToUpdate `
-MaxLength $expectedMaxLength `
-PasswordLifetimeDays $expectedPasswordLifetimeDays
@@ -74,17 +74,17 @@ Describe "PasswordPolicy Tests" {
$actual.MinLowercaseCount | Should Be $passwordPolicyToUpdate.MinLowercaseCount
# Cleanup
$passwordPolicyToUpdate | Set-PasswordPolicy
$passwordPolicyToUpdate | Set-SsoPasswordPolicy
}
It 'Updates password policy Description and MinUppercaseCount' {
# Arrange
$passwordPolicyToUpdate = Get-PasswordPolicy
$passwordPolicyToUpdate = Get-SsoPasswordPolicy
$expectedMinUppercaseCount = 0
$expectedDescription = "Test Description"
# Act
$actual = $passwordPolicyToUpdate | Set-PasswordPolicy `
$actual = $passwordPolicyToUpdate | Set-SsoPasswordPolicy `
-Description $expectedDescription `
-MinUppercaseCount $expectedMinUppercaseCount
@@ -103,7 +103,7 @@ Describe "PasswordPolicy Tests" {
$actual.MinLowercaseCount | Should Be $passwordPolicyToUpdate.MinLowercaseCount
# Cleanup
$passwordPolicyToUpdate | Set-PasswordPolicy
$passwordPolicyToUpdate | Set-SsoPasswordPolicy
}
}
}

View File

@@ -26,7 +26,7 @@ Describe "PersonUser Tests" {
}
AfterEach {
foreach ($personUser in $script:usersToCleanup) {
Remove-PersonUser -User $personUser
Remove-SsoPersonUser -User $personUser
}
$connectionsToCleanup = $global:DefaultSsoAdminServers.ToArray()
@@ -35,7 +35,7 @@ Describe "PersonUser Tests" {
}
}
Context "New-PersonUser" {
Context "New-SsoPersonUser" {
It 'Creates person user with details' {
# Arrange
$expectedUserName = "TestPersonUser1"
@@ -51,7 +51,7 @@ Describe "PersonUser Tests" {
-SkipCertificateCheck
# Act
$actual = New-PersonUser `
$actual = New-SsoPersonUser `
-Server $connection `
-UserName $expectedUserName `
-Password $expectedPassword `
@@ -84,7 +84,7 @@ Describe "PersonUser Tests" {
-SkipCertificateCheck
# Act
$actual = New-PersonUser `
$actual = New-SsoPersonUser `
-Server $connection `
-UserName $expectedUserName `
-Password $expectedPassword
@@ -103,7 +103,7 @@ Describe "PersonUser Tests" {
}
}
Context "Get-PersonUser" {
Context "Get-SsoPersonUser" {
It 'Gets person users without filters' {
# Arrange
$connection = Connect-SsoAdminServer `
@@ -113,7 +113,7 @@ Describe "PersonUser Tests" {
-SkipCertificateCheck
# Act
$actual = Get-PersonUser
$actual = Get-SsoPersonUser
# Assert
$actual | Should Not Be $null
@@ -134,20 +134,20 @@ Describe "PersonUser Tests" {
$secondUserName = "TestPersonUser4"
$password = '$tr0NG_TestPa$$w0rd'
$personUserToSearch = New-PersonUser `
$personUserToSearch = New-SsoPersonUser `
-UserName $expectedUserName `
-Password $password `
-Server $connection
$script:usersToCleanup += $personUserToSearch
$secondPersonUserToSearch = New-PersonUser `
$secondPersonUserToSearch = New-SsoPersonUser `
-UserName $secondUserName `
-Password $password `
-Server $connection
$script:usersToCleanup += $secondPersonUserToSearch
# Act
$actual = Get-PersonUser `
$actual = Get-SsoPersonUser `
-Name $expectedUserName `
-Domain $personUserToSearch.Domain `
-Server $connection
@@ -171,20 +171,20 @@ Describe "PersonUser Tests" {
$secondUserName = "TestPersonUser4"
$password = '$tr0NG_TestPa$$w0rd'
$personUserToSearch = New-PersonUser `
$personUserToSearch = New-SsoPersonUser `
-UserName $expectedUserName `
-Password $password `
-Server $connection
$script:usersToCleanup += $personUserToSearch
$secondPersonUserToSearch = New-PersonUser `
$secondPersonUserToSearch = New-SsoPersonUser `
-UserName $secondUserName `
-Password $password `
-Server $connection
$script:usersToCleanup += $secondPersonUserToSearch
# Act
$actual = Get-PersonUser `
$actual = Get-SsoPersonUser `
-Name "Test*" `
-Domain $personUserToSearch.Domain `
-Server $connection
@@ -208,20 +208,20 @@ Describe "PersonUser Tests" {
$secondUserName = "TestPersonUser4"
$password = '$tr0NG_TestPa$$w0rd'
$personUserToSearch = New-PersonUser `
$personUserToSearch = New-SsoPersonUser `
-UserName $expectedUserName `
-Password $password `
-Server $connection
$script:usersToCleanup += $personUserToSearch
$secondPersonUserToSearch = New-PersonUser `
$secondPersonUserToSearch = New-SsoPersonUser `
-UserName $secondUserName `
-Password $password `
-Server $connection
$script:usersToCleanup += $secondPersonUserToSearch
# Act
$actual = Get-PersonUser `
$actual = Get-SsoPersonUser `
-Name "TestPersonUser?" `
-Domain $personUserToSearch.Domain `
-Server $connection
@@ -244,7 +244,7 @@ Describe "PersonUser Tests" {
$expectedUserName = "TestPersonUser3"
$password = '$tr0NG_TestPa$$w0rd'
$personUserToSearch = New-PersonUser `
$personUserToSearch = New-SsoPersonUser `
-UserName $expectedUserName `
-Password $password `
-Server $connection
@@ -252,7 +252,7 @@ Describe "PersonUser Tests" {
# Act
$actual = Get-PersonUser `
$actual = Get-SsoPersonUser `
-Name "TestPersonUser" `
-Domain $personUserToSearch.Domain `
-Server $connection
@@ -262,7 +262,7 @@ Describe "PersonUser Tests" {
}
}
Context "Set-PersonUser" {
Context "Set-SsoPersonUser" {
It 'Adds person user to group' {
# Arrange
$userName = "TestAddGroupPersonUserName"
@@ -273,20 +273,20 @@ Describe "PersonUser Tests" {
-Password $Password `
-SkipCertificateCheck
$personUserToUpdate = New-PersonUser `
$personUserToUpdate = New-SsoPersonUser `
-UserName $userName `
-Password $userPassword `
-Server $connection
$script:usersToCleanup += $personUserToUpdate
$groupUserToBeAddedTo = Get-Group `
$groupUserToBeAddedTo = Get-SsoGroup `
-Name 'Administrators' `
-Domain $personUserToUpdate.Domain `
-Server $connection
# Act
$actual = Set-PersonUser `
$actual = Set-SsoPersonUser `
-User $personUserToUpdate `
-Group $groupUserToBeAddedTo `
-Add
@@ -305,25 +305,25 @@ Describe "PersonUser Tests" {
-Password $Password `
-SkipCertificateCheck
$personUserToUpdate = New-PersonUser `
$personUserToUpdate = New-SsoPersonUser `
-UserName $userName `
-Password $userPassword `
-Server $connection
$script:usersToCleanup += $personUserToUpdate
$groupToBeUsed = Get-Group `
$groupToBeUsed = Get-SsoGroup `
-Name 'Administrators' `
-Domain $personUserToUpdate.Domain `
-Server $connection
Set-PersonUser `
Set-SsoPersonUser `
-User $personUserToUpdate `
-Group $groupToBeUsed `
-Add
# Act
$actual = Set-PersonUser `
$actual = Set-SsoPersonUser `
-User $personUserToUpdate `
-Group $groupToBeUsed `
-Remove
@@ -343,7 +343,7 @@ Describe "PersonUser Tests" {
-Password $Password `
-SkipCertificateCheck
$personUserToUpdate = New-PersonUser `
$personUserToUpdate = New-SsoPersonUser `
-UserName $userName `
-Password $userPassword `
-Server $connection
@@ -351,7 +351,7 @@ Describe "PersonUser Tests" {
$script:usersToCleanup += $personUserToUpdate
# Act
$actual = Set-PersonUser `
$actual = Set-SsoPersonUser `
-User $personUserToUpdate `
-NewPassword $newPassword
@@ -369,7 +369,7 @@ Describe "PersonUser Tests" {
-Password $Password `
-SkipCertificateCheck
$personUserToUpdate = New-PersonUser `
$personUserToUpdate = New-SsoPersonUser `
-UserName $userName `
-Password $userPassword `
-Server $connection
@@ -377,7 +377,7 @@ Describe "PersonUser Tests" {
$script:usersToCleanup += $personUserToUpdate
# Act
$actual = Set-PersonUser `
$actual = Set-SsoPersonUser `
-User $personUserToUpdate `
-Unlock
@@ -386,7 +386,7 @@ Describe "PersonUser Tests" {
}
}
Context "Remove-PersonUser" {
Context "Remove-SsoPersonUser" {
It 'Removes person user' {
# Arrange
$userName = "TestPersonUser4"
@@ -398,17 +398,17 @@ Describe "PersonUser Tests" {
-SkipCertificateCheck
$personUserToRemove = New-PersonUser `
$personUserToRemove = New-SsoPersonUser `
-UserName $userName `
-Password $userPassword `
-Server $connection
# Act
Remove-PersonUser -User $personUserToRemove
Remove-SsoPersonUser -User $personUserToRemove
# Assert
$personUserToRemove | Should Not Be $null
$userFromServer = Get-PersonUser `
$userFromServer = Get-SsoPersonUser `
-Name $personUserToRemove.Name `
-Domain $personUserToRemove.Domain `
-Server $connection

View File

@@ -36,10 +36,10 @@ Describe "TokenLifetime Tests" {
}
}
Context "Get-TokenLifetime" {
Context "Get-SsoTokenLifetime" {
It 'Gets token lifetime settings' {
# Act
$actual = Get-TokenLifetime
$actual = Get-SsoTokenLifetime
# Assert
$actual | Should Not Be $null
@@ -48,15 +48,15 @@ Describe "TokenLifetime Tests" {
}
}
Context "Set-TokenLifetime" {
Context "Set-SsoTokenLifetime" {
It 'Updates MaxHoKTokenLifetime and MaxBearerTokenLifetime' {
# Arrange
$tokenLifetimeToUpdate = Get-TokenLifetime
$tokenLifetimeToUpdate = Get-SsoTokenLifetime
$expectedMaxHoKTokenLifetime = 60
$expectedMaxBearerTokenLifetime = 30
# Act
$actual = Set-TokenLifetime `
$actual = Set-SsoTokenLifetime `
-TokenLifetime $tokenLifetimeToUpdate `
-MaxHoKTokenLifetime $expectedMaxHoKTokenLifetime `
-MaxBearerTokenLifetime $expectedMaxBearerTokenLifetime
@@ -67,7 +67,7 @@ Describe "TokenLifetime Tests" {
$actual.MaxBearerTokenLifetime | Should Be $expectedMaxBearerTokenLifetime
# Cleanup
$tokenLifetimeToUpdate | Set-TokenLifetime `
$tokenLifetimeToUpdate | Set-SsoTokenLifetime `
-MaxHoKTokenLifetime $tokenLifetimeToUpdate.MaxHoKTokenLifetime `
-MaxBearerTokenLifetime $tokenLifetimeToUpdate.MaxBearerTokenLifetime
}