@@ -3093,8 +3093,8 @@ function Global:New-SgwAccount {
30933093 if (!$Server) {
30943094 Throw "No StorageGRID admin node management server found. Please run Connect-SgwServer to continue."
30953095 }
3096- if ($Server.APIVersion -ge 2 -and !$Password) {
3097- Throw "Password required"
3096+ if ($Server.APIVersion -ge 2 -and !$Password -and !$GrantRootAccessToGroup ) {
3097+ Throw "Password or GrantRootAccessToGroup required"
30983098 }
30993099 if ($Server.APIVersion -lt 2 -and ($Quota -or $Password)) {
31003100 Write-Warning "Quota and password will be ignored in API Version $( $Server.APIVersion )"
@@ -3116,6 +3116,11 @@ function Global:New-SgwAccount {
31163116 Throw "Password does not meet minimum length requirement of 8 characters"
31173117 }
31183118 }
3119+
3120+ if ($Server.UseSso -and !$GrantRootAccessToGroup) {
3121+ Write-Warning "SSO is enabled, you must specify a group for root access using -GrantRootAccessToGroup"
3122+ Throw "SSO is enabled, you must specify a group for root access using -GrantRootAccessToGroup"
3123+ }
31193124 }
31203125
31213126 Process {
@@ -3139,7 +3144,11 @@ function Global:New-SgwAccount {
31393144 }
31403145 if ($Server.ApiVersion -ge 3) {
31413146 if ($GrantRootAccessToGroup) {
3142- $Body.grantRootAccessToGroup = $grantRootAccessToGroup
3147+ $Body.policy.useAccountIdentitySource = $false
3148+ if ($GrantRootAccessToGroup -notmatch 'federated-group/') {
3149+ $GrantRootAccessToGroup = 'federated-group/' + $GrantRootAccessToGroup
3150+ }
3151+ $Body.grantRootAccessToGroup = $GrantRootAccessToGroup
31433152 }
31443153 }
31453154
@@ -4286,7 +4295,8 @@ function global:Connect-SgwServer {
42864295 TemporaryAccessKeyExpirationTime = $TemporaryAccessKeyExpirationTime;
42874296 AccessKeyStore = @{ };
42884297 AccountId = "";
4289- TenantPortal = ""
4298+ TenantPortal = "";
4299+ UseSso = $False;
42904300 }
42914301
42924302 if ([environment]::OSVersion.Platform -match "Win") {
@@ -4594,6 +4604,8 @@ function global:Invoke-SgwServerSsoAuthentication {
45944604 $Server.Headers["Authorization"] = "Bearer $( $Content.data )"
45954605 $Server.Session = $StorageGridSession
45964606
4607+ $Server.UseSso = $True
4608+
45974609 Write-Output $Server
45984610 }
45994611}
0 commit comments