Skip to content

Commit

Permalink
Merge pull request #5749 from JuliusRauschen/spo-tenant-settings-new-…
Browse files Browse the repository at this point in the history
…parameter

Add additional properties to SPOTenantSettings
  • Loading branch information
NikCharlebois authored Feb 26, 2025
2 parents a5e1787 + 616904b commit 711f0dc
Show file tree
Hide file tree
Showing 3 changed files with 50 additions and 1 deletion.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
* SPOSiteScript
* Fix error in Get-TargetResource when a site-script is identified by title only
FIXES [#5821](https://github.com/microsoft/Microsoft365DSC/issues/5821)
* SPOTenantSettings
* Add EnableAzureADB2BIntegration and OneDriveSharingCapability properties
* TeamsChannel
* Apply ordering during export.
FIXES [#5829](https://github.com/microsoft/Microsoft365DSC/issues/5829)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,15 @@ function Get-TargetResource
[String]
$IsSingleInstance,

[Parameter()]
[System.Boolean]
$EnableAzureADB2BIntegration,

[Parameter()]
[ValidateSet('ExternalUserAndGuestSharing', 'Disabled', 'ExternalUserSharingOnly', 'ExistingExternalUserSharingOnly')]
[System.String]
$OneDriveSharingCapability,

[Parameter()]
[System.UInt32]
$MinCompatibilityLevel,
Expand Down Expand Up @@ -209,7 +218,9 @@ function Get-TargetResource
'AllowSelectSGsInODBListInTenant',
'DenySelectSGsInODBListInTenant',
'DenySelectSecurityGroupsInSPSitesList',
'AllowSelectSecurityGroupsInSPSitesList')
'AllowSelectSecurityGroupsInSPSitesList',
'EnableAzureADB2BIntegration',
'OneDriveSharingCapability')

$response = Invoke-PnPSPRestMethod -Method Get `
-Url "$((Get-MSCloudLoginConnectionProfile -Workload PnP).AdminUrl)/_api/SPO.Tenant?`$select=$($parametersToRetrieve -join ',')"
Expand All @@ -222,6 +233,8 @@ function Get-TargetResource
DenySelectSGsInODBListInTenant = $response.DenySelectSGsInODBListInTenant
DenySelectSecurityGroupsInSPSitesList = $response.DenySelectSecurityGroupsInSPSitesList
AllowSelectSecurityGroupsInSPSitesList = $response.AllowSelectSecurityGroupsInSPSitesList
EnableAzureADB2BIntegration = $response.EnableAzureADB2BIntegration
OneDriveSharingCapability = $response.OneDriveSharingCapability
MinCompatibilityLevel = $MinCompat
MaxCompatibilityLevel = $MaxCompat
SearchResolveExactEmailOrUPN = $SPOTenantSettings.SearchResolveExactEmailOrUPN
Expand Down Expand Up @@ -283,6 +296,15 @@ function Set-TargetResource
[String]
$IsSingleInstance,

[Parameter()]
[System.Boolean]
$EnableAzureADB2BIntegration,

[Parameter()]
[ValidateSet('ExternalUserAndGuestSharing', 'Disabled', 'ExternalUserSharingOnly', 'ExistingExternalUserSharingOnly')]
[System.String]
$OneDriveSharingCapability,

[Parameter()]
[System.UInt32]
$MinCompatibilityLevel,
Expand Down Expand Up @@ -476,6 +498,8 @@ function Set-TargetResource
$CurrentParameters.Remove('DenySelectSGsInODBListInTenant') | Out-Null
$CurrentParameters.Remove('DenySelectSecurityGroupsInSPSitesList') | Out-Null
$CurrentParameters.Remove('AllowSelectSecurityGroupsInSPSitesList') | Out-Null
$CurrentParameters.Remove('EnableAzureADB2BIntegration') | Out-Null
$CurrentParameters.Remove('OneDriveSharingCapability') | Out-Null

$CurrentParameters.Remove('TenantDefaultTimezone') | Out-Null # this one is updated separately using Graph
if ($CurrentParameters.Keys.Contains('UserVoiceForFeedbackEnabled'))
Expand Down Expand Up @@ -532,6 +556,18 @@ function Set-TargetResource
$paramsToUpdate.Add('AllowSelectSecurityGroupsInSPSitesList', $AllowSelectSecurityGroupsInSPSitesList)
}

if ($null -ne $EnableAzureADB2BIntegration)
{
$needToUpdate = $true
$paramsToUpdate.Add('EnableAzureADB2BIntegration', $EnableAzureADB2BIntegration)
}

if ($null -ne $OneDriveSharingCapability)
{
$needToUpdate = $true
$paramsToUpdate.Add('OneDriveSharingCapability', $OneDriveSharingCapability)
}

if ($needToUpdate)
{
Write-Verbose -Message 'Updating properties via REST PATCH call.'
Expand Down Expand Up @@ -564,6 +600,15 @@ function Test-TargetResource
[String]
$IsSingleInstance,

[Parameter()]
[System.Boolean]
$EnableAzureADB2BIntegration,

[Parameter()]
[ValidateSet('ExternalUserAndGuestSharing', 'Disabled', 'ExternalUserSharingOnly', 'ExistingExternalUserSharingOnly')]
[System.String]
$OneDriveSharingCapability,

[Parameter()]
[System.UInt32]
$MinCompatibilityLevel,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
class MSFT_SPOTenantSettings : OMI_BaseResource
{
[Key, Description("Specifies the resource is a single instance, the value must be 'Yes'"),ValueMap{"Yes"},Values{"Yes"}] String IsSingleInstance;
[Write, Description("Enables OneDrive and SharePoint integration with Microsoft Entra B2B.")] boolean EnableAzureADB2BIntegration;
[Write, Description("Determines what level of sharing is available for OneDrive sites. It corresponds to the SharingCapabilities for OneDrive sites."), ValueMap{"ExternalUserAndGuestSharing", "Disabled", "ExternalUserSharingOnly", "ExistingExternalUserSharingOnly"}, Values{"ExternalUserAndGuestSharing", "Disabled", "ExternalUserSharingOnly", "ExistingExternalUserSharingOnly"}] string OneDriveSharingCapability;
[Write, Description("Specifies the lower bound on the compatibility level for new sites.")] uint32 MinCompatibilityLevel;
[Write, Description("Specifies the upper bound on the compatibility level for new sites.")] uint32 MaxCompatibilityLevel;
[Write, Description("Removes the search capability from People Picker. Note, recently resolved names will still appear in the list until browser cache is cleared or expired.")] boolean SearchResolveExactEmailOrUPN;
Expand Down

0 comments on commit 711f0dc

Please sign in to comment.