diff --git a/CHANGELOG.md b/CHANGELOG.md index 0fbc35aa9d..653f45faab 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,8 @@ * BREAKING CHANGES * O365Group * ManagedBy is now a mandatory property + * SPOSite + * Owner is now a mandatory property * Modules * Added embedded Log Engine * SCRetentionCompliancePolicy @@ -18,3 +20,6 @@ * Initial Release * SCSupervisoryReviewRule * Initial Release +* SPOSite + * Added default value for Storage Quota + * Fixed an issue with site creation that could result in infinite loops diff --git a/Modules/Office365DSC/DSCResources/MSFT_SPOApp/MSFT_SPOApp.psm1 b/Modules/Office365DSC/DSCResources/MSFT_SPOApp/MSFT_SPOApp.psm1 index a9eaf17efb..b1e7a56654 100644 --- a/Modules/Office365DSC/DSCResources/MSFT_SPOApp/MSFT_SPOApp.psm1 +++ b/Modules/Office365DSC/DSCResources/MSFT_SPOApp/MSFT_SPOApp.psm1 @@ -34,7 +34,7 @@ function Get-TargetResource $GlobalAdminAccount ) - Write-Verbose -Message "GSetting configuration for app $Identity" + Write-Verbose -Message "Getting configuration for app $Identity" $nullReturn = @{ Identity = "" diff --git a/Modules/Office365DSC/DSCResources/MSFT_SPOSite/MSFT_SPOSite.psm1 b/Modules/Office365DSC/DSCResources/MSFT_SPOSite/MSFT_SPOSite.psm1 index 9e887bf1fa..1e1543e874 100644 --- a/Modules/Office365DSC/DSCResources/MSFT_SPOSite/MSFT_SPOSite.psm1 +++ b/Modules/Office365DSC/DSCResources/MSFT_SPOSite/MSFT_SPOSite.psm1 @@ -8,7 +8,7 @@ function Get-TargetResource [System.String] $Url, - [Parameter()] + [Parameter(Mandatory = $true)] [System.String] $Owner, @@ -269,13 +269,13 @@ function Set-TargetResource [System.String] $Url, - [Parameter()] + [Parameter(Mandatory = $true)] [System.String] $Owner, [Parameter()] [System.UInt32] - $StorageQuota, + $StorageQuota = 26214400, [Parameter()] [System.String] @@ -453,13 +453,13 @@ function Test-TargetResource [System.String] $Url, - [Parameter()] + [Parameter(Mandatory = $true)] [System.String] $Owner, [Parameter()] [System.UInt32] - $StorageQuota, + $StorageQuota = 26214400, [Parameter()] [System.String] @@ -637,6 +637,10 @@ function Export-TargetResource [System.String] $Url, + [Parameter(Mandatory = $true)] + [System.String] + $Owner, + [Parameter(Mandatory = $true)] [System.String] $CentralAdminUrl, @@ -672,13 +676,13 @@ function Set-SPOSiteConfiguration [System.String] $Url, - [Parameter()] + [Parameter(Mandatory = $true)] [System.String] $Owner, [Parameter()] [System.UInt32] - $StorageQuota, + $StorageQuota = 26214400, [Parameter()] [System.String] @@ -800,7 +804,11 @@ function Set-SPOSiteConfiguration [Parameter(Mandatory = $true)] [System.Management.Automation.PSCredential] - $GlobalAdminAccount + $GlobalAdminAccount, + + [Parameter()] + [System.Boolean] + $IsSecondTry = $false ) Test-MSCloudLogin -ConnectionUrl $CentralAdminUrl ` -O365Credential $GlobalAdminAccount ` @@ -953,6 +961,7 @@ function Set-SPOSiteConfiguration if ($CurrentParameters.ContainsKey("Template")) { $null = $CurrentParameters.Remove("Template") } if ($CurrentParameters.ContainsKey("LocaleId")) { $null = $CurrentParameters.Remove("LocaleId") } if ($CurrentParameters.ContainsKey("HubUrl")) { $null = $CurrentParameters.Remove("HubUrl") } + if ($CurrentParameters.ContainsKey("IsSecondTry")) { $null = $CurrentParameters.Remove("IsSecondTry") } if ($CurrentParameters.Count -gt 0) { Set-SPOSite -Identity $Url @CurrentParameters -NoWait @@ -972,7 +981,15 @@ function Set-SPOSiteConfiguration Template = $Template } New-SPOSite @siteCreation - $CurrentParameters4Config = $PSBoundParameters - Set-SPOSiteConfiguration @CurrentParameters4Config + + if (-not $IsSecondTry) + { + $CurrentParameters4Config = $PSBoundParameters + Set-SPOSiteConfiguration @CurrentParameters4Config -IsSecondTry $true + } + else + { + throw "There was an error trying to create SPOSite $Url" + } } } diff --git a/Modules/Office365DSC/DSCResources/MSFT_SPOSite/MSFT_SPOSite.schema.mof b/Modules/Office365DSC/DSCResources/MSFT_SPOSite/MSFT_SPOSite.schema.mof index d7cfd297b0..35d090e2d9 100644 --- a/Modules/Office365DSC/DSCResources/MSFT_SPOSite/MSFT_SPOSite.schema.mof +++ b/Modules/Office365DSC/DSCResources/MSFT_SPOSite/MSFT_SPOSite.schema.mof @@ -2,8 +2,8 @@ class MSFT_SPOSite : OMI_BaseResource { [Key, Description("The URL of the site collection")] string Url; - [Write, Description("The username of the site collection administrator")] string Owner; - [Write, Description("The resource quota to apply to the site collection")] uint32 StorageQuota; + [Key, Description("The username of the site collection administrator")] string Owner; + [Write, Description("The resource quota to apply to the site collection. Default value is 26214400")] uint32 StorageQuota; [Write, Description("The title of the site")] string Title; [Write, Description("The compatibility level of the site")] uint32 CompatibilityLevel; [Write, Description("The locale code of the site")] uint32 LocaleId; diff --git a/Modules/Office365DSC/Modules/O365DSCReverse.psm1 b/Modules/Office365DSC/Modules/O365DSCReverse.psm1 index 94c4263084..94d4d1ff11 100644 --- a/Modules/Office365DSC/Modules/O365DSCReverse.psm1 +++ b/Modules/Office365DSC/Modules/O365DSCReverse.psm1 @@ -721,6 +721,7 @@ function Start-O365ConfigurationExtract { Write-Information " - [$i/$($sites.Length)] $($site.Url)" $partialContent = Export-TargetResource -Url $site.Url ` + -Owner "Reverse" ` -CentralAdminUrl $centralAdminUrl ` -GlobalAdminAccount $GlobalAdminAccount diff --git a/Modules/Office365DSC/Office365DSC.psd1 b/Modules/Office365DSC/Office365DSC.psd1 index 4385e6dc65..8368b6bcf7 100644 --- a/Modules/Office365DSC/Office365DSC.psd1 +++ b/Modules/Office365DSC/Office365DSC.psd1 @@ -11,7 +11,7 @@ # RootModule = '' # Version number of this module. - ModuleVersion = '1.0.0.733' + ModuleVersion = '1.0.0.744' # Supported PSEditions # CompatiblePSEditions = @() @@ -56,7 +56,7 @@ @{ModuleName = "Microsoft.Online.SharePoint.PowerShell"; RequiredVersion = "16.0.8316.0"; }, @{ModuleName = "MicrosoftTeams"; RequiredVersion = "1.0.0"; }, @{ModuleName = "AzureAD"; RequiredVersion = "2.0.2.4"; }, - @{ModuleName = "MSCloudLoginAssistant"; RequiredVersion = "0.5.5"; }) + @{ModuleName = "MSCloudLoginAssistant"; RequiredVersion = "0.5.6"; }) # Assemblies that must be loaded prior to importing this module # RequiredAssemblies = @() diff --git a/Tests/Integration/O365Integration.Master.Tests.ps1 b/Tests/Integration/O365Integration.Master.Tests.ps1 index 6bb1f68e17..bea8d2d9d0 100644 --- a/Tests/Integration/O365Integration.Master.Tests.ps1 +++ b/Tests/Integration/O365Integration.Master.Tests.ps1 @@ -94,6 +94,28 @@ Configuration Master DependsOn = "[O365User]JohnSmith" } + SPOSite ClassicSite + { + Title = "Classic Site" + Url = "https://o365dsc.sharepoint.com/sites/Classic" + Owner = "adminnonMFA@o365dsc.onmicrosoft.com" + Template = "STS#0" + CentralAdminUrl = "https://o365dsc-admin.sharepoint.com" + GlobalAdminAccount = $GlobalAdmin + Ensure = "Present" + } + + SPOSite ModernSite + { + Title = "Modern Site" + Url = "https://o365dsc.sharepoint.com/sites/Modern" + Owner = "admin@o365dsc.onmicrosoft.com" + Template = "STS#3" + CentralAdminUrl = "https://o365dsc-admin.sharepoint.com" + GlobalAdminAccount = $GlobalAdmin + Ensure = "Present" + } + TeamsTeam TeamAlpha { DisplayName = "Alpha Team" diff --git a/Tests/Unit/Office365DSC/Office365DSC.SPOSite.Tests.ps1 b/Tests/Unit/Office365DSC/Office365DSC.SPOSite.Tests.ps1 index a1d6ac339e..c3b30aab37 100644 --- a/Tests/Unit/Office365DSC/Office365DSC.SPOSite.Tests.ps1 +++ b/Tests/Unit/Office365DSC/Office365DSC.SPOSite.Tests.ps1 @@ -810,6 +810,7 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { $testParams = @{ Url = "https://contoso.com/sites/TestSite" CentralAdminUrl = "https://contoso-admin.sharepoint.com" + Owner = "testuser@contoso.com" GlobalAdminAccount = $GlobalAdminAccount } diff --git a/appveyor.yml b/appveyor.yml index d4b8e3147a..ddd8b3f3d1 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -13,7 +13,7 @@ install: Install-Module MSOnline -RequiredVersion 1.1.183.17 -Force Install-Module MicrosoftTeams -RequiredVersion 1.0.0 -Force Install-Module SharePointPnPPowerShellOnline -RequiredVersion 3.11.1907.0 -Force - Install-Module MSCloudLoginAssistant -RequiredVersion 0.5.5 -Force + Install-Module MSCloudLoginAssistant -RequiredVersion 0.5.6 -Force $webClient = new-object System.Net.WebClient $url = "https://github.com/Microsoft/Office365DSC/blob/Dev/Tests/Dependencies/SharePointOnlineManagementShell_8615-1200_x64_en-us.msi?raw=true" diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 1da6aeafad..0b98dda221 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -15,7 +15,7 @@ steps: inputs: targetType: 'inline' failOnStderr: true - script: Install-Module Microsoft.Online.SharePoint.PowerShell -RequiredVersion "16.0.8316.0" -Force;Install-Module AzureAD -RequiredVersion "2.0.2.4" -Force; Install-Module MicrosoftTeams -RequiredVersion "1.0.0" -Force;Install-Module SharePointPnPPowerShellOnline -RequiredVersion "3.11.1907.0" -Force;Install-Module MSOnline -Force;Install-Module ReverseDSC -Requiredversion "1.9.4.4" -Force;Install-Module MSCloudLoginAssistant -Force -RequiredVersion "0.5.5";Import-Module '$(build.artifactstagingdirectory)\BuildFiles\Tests\TestHarness.psm1' -Force;Invoke-TestHarness + script: Install-Module Microsoft.Online.SharePoint.PowerShell -RequiredVersion "16.0.8316.0" -Force;Install-Module AzureAD -RequiredVersion "2.0.2.4" -Force; Install-Module MicrosoftTeams -RequiredVersion "1.0.0" -Force;Install-Module SharePointPnPPowerShellOnline -RequiredVersion "3.11.1907.0" -Force;Install-Module MSOnline -Force;Install-Module ReverseDSC -Requiredversion "1.9.4.4" -Force;Install-Module MSCloudLoginAssistant -Force -RequiredVersion "0.5.6";Import-Module '$(build.artifactstagingdirectory)\BuildFiles\Tests\TestHarness.psm1' -Force;$results = Invoke-TestHarness; if ($results.FailedCount -gt 0){throw "Unit Test Failed"} - task: PublishBuildArtifacts@1 inputs: pathtoPublish: '$(Build.ArtifactStagingDirectory)'