From 43b7723c032bf2d0a5cbe8a80e87f3a618a02d9e Mon Sep 17 00:00:00 2001 From: Yvan Duhamel Date: Thu, 21 Apr 2022 16:44:43 +0200 Subject: [PATCH] Publish v15 (#160) * Augmentation is now enabled by default on a new LDAP connection, when it is added through the UI * Augment groups with the same attribute as the one set in the LDAPCP configuration. https://github.com/Yvand/LDAPCP/issues/148 * Fix: In claims configurfation page, the values in the list of "PickerEntity metadata" was not populated correctly, which caused an issue with the "Title" (and a few others) * Update NuGet package NUnit3TestAdapter to v3.16.1 * Update NuGet package Newtonsoft.Json to 12.0.3 --- CHANGELOG.md | 8 + DevOps-RunTests.yml | 123 ------ LDAPCP.Tests/BackupCurrentConfig.cs | 2 + LDAPCP.Tests/LDAPCP.Tests.csproj | 8 +- LDAPCP.Tests/ModifyConfigTests.cs | 2 + LDAPCP.Tests/UnitTestsHelper.cs | 101 +++-- LDAPCP/ADMIN/LDAPCP/ClaimTypesConfig.ascx.cs | 4 +- LDAPCP/ADMIN/LDAPCP/ClaimTypesConfig.aspx | 2 +- LDAPCP/ADMIN/LDAPCP/GlobalSettings.ascx | 20 +- LDAPCP/ADMIN/LDAPCP/GlobalSettings.ascx.cs | 9 +- LDAPCP/LDAPCP.AdminLinks/Elements.xml | 9 + LDAPCP/LDAPCP.cs | 24 +- LDAPCP/LDAPCP.csproj | 2 +- LDAPCP/LDAPCPConfig.cs | 10 +- azure-pipelines.yml | 398 ------------------ .../ci-apply-dtl-artifacts.yml | 56 ++- .../ci-compile.yml | 6 +- .../ci-create-dtl-environment.yml | 10 +- azure-pipelines/ci-run-integration-tests.yml | 56 +++ 19 files changed, 248 insertions(+), 602 deletions(-) delete mode 100644 DevOps-RunTests.yml delete mode 100644 azure-pipelines.yml rename DevOps-ApplyDTLArtifacts.yml => azure-pipelines/ci-apply-dtl-artifacts.yml (60%) rename DevOps-Compile.yml => azure-pipelines/ci-compile.yml (95%) rename DevOps-CreateDTLEnvironment.yml => azure-pipelines/ci-create-dtl-environment.yml (58%) create mode 100644 azure-pipelines/ci-run-integration-tests.yml diff --git a/CHANGELOG.md b/CHANGELOG.md index eab28ce..5fd7a09 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,13 @@ # Change log for LDAPCP +## Unreleased + +* Augmentation is now enabled by default on a new LDAP connection, when it is added through the UI +* Augment groups with the same attribute as the one set in the LDAPCP configuration. https://github.com/Yvand/LDAPCP/issues/148 +* Fix: In claims configurfation page, the values in the list of "PickerEntity metadata" was not populated correctly, which caused an issue with the "Title" (and a few others) +* Update NuGet package NUnit3TestAdapter to v3.16.1 +* Update NuGet package Newtonsoft.Json to 12.0.3 + ## LDAPCP 14.1.20191007.981 enhancements & bug-fixes - Published in October 7, 2019 * Fix regression: after installing v14, users are stuck in SharePoint just after sign-in to ADFS. https://github.com/Yvand/LDAPCP/issues/99 diff --git a/DevOps-RunTests.yml b/DevOps-RunTests.yml deleted file mode 100644 index c6ac3d8..0000000 --- a/DevOps-RunTests.yml +++ /dev/null @@ -1,123 +0,0 @@ -resources: -- repo: self - -jobs: -- job: RunTestSP2013 - condition: eq(variables['Deployment.ProvisionSharePoint2013'], 'yes') - displayName: Run tests on SP2013 - timeoutInMinutes: 15 - variables: - jobSharePointVersion: 2013 - pool: - name: $(System.TeamProject)-Tests-2013 - steps: - - checkout: none #skip checking out the default repository resource - - task: DownloadBuildArtifacts@0 - displayName: 'Download Build Artifacts' - inputs: - buildType: specific - project: '$(System.TeamProjectId)' - pipeline: $(DevOps.BuildArtifactsPipelineID) - specificBuildWithTriggering: true - artifactName: 'drop_$(Tests.BuildConfiguration)' - downloadPath: $(Build.ArtifactStagingDirectory) - itemPattern: | - drop_$(Tests.BuildConfiguration)/$(System.TeamProject)/bin/Release/$(System.TeamProject).pdb - drop_$(Tests.BuildConfiguration)/$(System.TeamProject).Tests/bin/Release/*.dll - drop_$(Tests.BuildConfiguration)/$(Tests.DataFolderName)/?(*.csv|*.json|*.runsettings) - - - task: VisualStudioTestPlatformInstaller@1 - displayName: 'Visual Studio Test Platform Installer' - - - task: VSTest@2 - displayName: 'Run Visual Studio tests' - inputs: - searchFolder: '$(Build.ArtifactStagingDirectory)/drop_$(Tests.BuildConfiguration)/$(System.TeamProject).Tests/bin/Release' - vsTestVersion: toolsInstaller - runSettingsFile: '$(Build.ArtifactStagingDirectory)/drop_$(Tests.BuildConfiguration)/$(Tests.DataFolderName)/DTLServer.runsettings' - overrideTestrunParameters: '$(Tests.OverrideTestrunParameters)' - codeCoverageEnabled: $(Tests.CodeCoverageEnabled) - otherConsoleOptions: '/Platform:x64' - testRunTitle: '$(System.TeamProject)-Tests-SP$(jobSharePointVersion)' - platform: '$(BuildPlatform)' - configuration: $(Tests.BuildConfiguration) - -- job: RunTestSP2016 - condition: eq(variables['Deployment.ProvisionSharePoint2016'], 'yes') - displayName: Run tests on SP2016 - timeoutInMinutes: 15 - variables: - jobSharePointVersion: 2016 - pool: - name: $(System.TeamProject)-Tests-2016 - steps: - - checkout: none #skip checking out the default repository resource - - task: DownloadBuildArtifacts@0 - displayName: 'Download Build Artifacts' - inputs: - buildType: specific - project: '$(System.TeamProjectId)' - pipeline: $(DevOps.BuildArtifactsPipelineID) - specificBuildWithTriggering: true - artifactName: 'drop_$(Tests.BuildConfiguration)' - downloadPath: $(Build.ArtifactStagingDirectory) - itemPattern: | - drop_$(Tests.BuildConfiguration)/$(System.TeamProject)/bin/Release/$(System.TeamProject).pdb - drop_$(Tests.BuildConfiguration)/$(System.TeamProject).Tests/bin/Release/*.dll - drop_$(Tests.BuildConfiguration)/$(Tests.DataFolderName)/?(*.csv|*.json|*.runsettings) - - - task: VisualStudioTestPlatformInstaller@1 - displayName: 'Visual Studio Test Platform Installer' - - - task: VSTest@2 - displayName: 'Run Visual Studio tests' - inputs: - searchFolder: '$(Build.ArtifactStagingDirectory)/drop_$(Tests.BuildConfiguration)/$(System.TeamProject).Tests/bin/Release' - vsTestVersion: toolsInstaller - runSettingsFile: '$(Build.ArtifactStagingDirectory)/drop_$(Tests.BuildConfiguration)/$(Tests.DataFolderName)/DTLServer.runsettings' - overrideTestrunParameters: '$(Tests.OverrideTestrunParameters)' - codeCoverageEnabled: $(Tests.CodeCoverageEnabled) - otherConsoleOptions: '/Platform:x64' - testRunTitle: '$(System.TeamProject)-Tests-SP$(jobSharePointVersion)' - platform: '$(BuildPlatform)' - configuration: $(Tests.BuildConfiguration) - -- job: RunTestSP2019 - condition: eq(variables['Deployment.ProvisionSharePoint2019'], 'yes') - displayName: Run tests on SP2019 - timeoutInMinutes: 15 - variables: - jobSharePointVersion: 2019 - pool: - name: $(System.TeamProject)-Tests-2019 - steps: - - checkout: none #skip checking out the default repository resource - - task: DownloadBuildArtifacts@0 - displayName: 'Download Build Artifacts' - inputs: - buildType: specific - project: '$(System.TeamProjectId)' - pipeline: $(DevOps.BuildArtifactsPipelineID) - specificBuildWithTriggering: true - artifactName: 'drop_$(Tests.BuildConfiguration)' - downloadPath: $(Build.ArtifactStagingDirectory) - itemPattern: | - drop_$(Tests.BuildConfiguration)/$(System.TeamProject)/bin/Release/$(System.TeamProject).pdb - drop_$(Tests.BuildConfiguration)/$(System.TeamProject).Tests/bin/Release/*.dll - drop_$(Tests.BuildConfiguration)/$(Tests.DataFolderName)/?(*.csv|*.json|*.runsettings) - - - task: VisualStudioTestPlatformInstaller@1 - displayName: 'Visual Studio Test Platform Installer' - - - task: VSTest@2 - displayName: 'Run Visual Studio tests' - inputs: - searchFolder: '$(Build.ArtifactStagingDirectory)/drop_$(Tests.BuildConfiguration)/$(System.TeamProject).Tests/bin/Release' - vsTestVersion: toolsInstaller - runSettingsFile: '$(Build.ArtifactStagingDirectory)/drop_$(Tests.BuildConfiguration)/$(Tests.DataFolderName)/DTLServer.runsettings' - overrideTestrunParameters: '$(Tests.OverrideTestrunParameters)' - codeCoverageEnabled: $(Tests.CodeCoverageEnabled) - otherConsoleOptions: '/Platform:x64' - testRunTitle: '$(System.TeamProject)-Tests-SP$(jobSharePointVersion)' - platform: '$(BuildPlatform)' - configuration: $(Tests.BuildConfiguration) diff --git a/LDAPCP.Tests/BackupCurrentConfig.cs b/LDAPCP.Tests/BackupCurrentConfig.cs index d529242..29d933e 100644 --- a/LDAPCP.Tests/BackupCurrentConfig.cs +++ b/LDAPCP.Tests/BackupCurrentConfig.cs @@ -16,6 +16,7 @@ public class BackupCurrentConfig [OneTimeSetUp] public void Init() { + Trace.WriteLine($"{DateTime.Now.ToString("s")} Start backup of current LDAPCP configuration"); Config = LDAPCPConfig.GetConfiguration(UnitTestsHelper.ClaimsProviderConfigName, UnitTestsHelper.SPTrust.Name); if (Config == null) { @@ -39,6 +40,7 @@ public void Cleanup() { Config.ApplyConfiguration(BackupConfig); Config.Update(); + Trace.WriteLine($"{DateTime.Now.ToString("s")} Restored original settings of LDAPCP configuration"); } } } diff --git a/LDAPCP.Tests/LDAPCP.Tests.csproj b/LDAPCP.Tests/LDAPCP.Tests.csproj index 9c4fd09..fae8d8d 100644 --- a/LDAPCP.Tests/LDAPCP.Tests.csproj +++ b/LDAPCP.Tests/LDAPCP.Tests.csproj @@ -60,13 +60,15 @@ 1.0.12 - 12.0.2 + 13.0.1 - 3.12.0 + 3.13.3 - 3.13.0 + 4.2.1 + runtime; build; native; contentfiles; analyzers; buildtransitive + all diff --git a/LDAPCP.Tests/ModifyConfigTests.cs b/LDAPCP.Tests/ModifyConfigTests.cs index 233e10e..e2a5429 100644 --- a/LDAPCP.Tests/ModifyConfigTests.cs +++ b/LDAPCP.Tests/ModifyConfigTests.cs @@ -85,8 +85,10 @@ public void DuplicateClaimType() // Modify an existing claim type to set a claim type already defined should throw exception InvalidOperationException var anotherCTConfig = Config.ClaimTypes.FirstOrDefault(x => !String.IsNullOrEmpty(x.ClaimType) && !String.Equals(firstCTConfig.ClaimType, x.ClaimType, StringComparison.InvariantCultureIgnoreCase)); + string backupClaimType = anotherCTConfig.ClaimType; anotherCTConfig.ClaimType = firstCTConfig.ClaimType; Assert.Throws(() => Config.Update(), $"Modify an existing claim type to set a claim type already defined should throw exception InvalidOperationException with this message: \"{ConfigUpdateErrorMessage}\""); + anotherCTConfig.ClaimType = backupClaimType; // Revert the change to continue with a clean config } [Test] diff --git a/LDAPCP.Tests/UnitTestsHelper.cs b/LDAPCP.Tests/UnitTestsHelper.cs index 831bf1c..e84cdc7 100644 --- a/LDAPCP.Tests/UnitTestsHelper.cs +++ b/LDAPCP.Tests/UnitTestsHelper.cs @@ -50,11 +50,6 @@ public class UnitTestsHelper [OneTimeSetUp] public static void InitializeSiteCollection() { -#if DEBUG - TestSiteCollUri = new Uri("http://spsites/sites/" + TestContext.Parameters["TestSiteCollectionName"]); - return; // Uncommented when debugging LDAPCP code from unit tests -#endif - logFileListener = new TextWriterTraceListener(TestContext.Parameters["TestLogFileName"]); Trace.Listeners.Add(logFileListener); Trace.AutoFlush = true; @@ -62,6 +57,12 @@ public static void InitializeSiteCollection() Trace.WriteLine($"{DateTime.Now.ToString("s")} DataFile_AllAccounts_Search: {DataFile_AllAccounts_Search}"); Trace.WriteLine($"{DateTime.Now.ToString("s")} DataFile_AllAccounts_Validate: {DataFile_AllAccounts_Validate}"); Trace.WriteLine($"{DateTime.Now.ToString("s")} TestSiteCollectionName: {TestContext.Parameters["TestSiteCollectionName"]}"); + +#if DEBUG + TestSiteCollUri = new Uri("http://spsites/sites/" + TestContext.Parameters["TestSiteCollectionName"]); + //return; // Uncommented when debugging LDAPCP code from unit tests +#endif + if (SPTrust == null) { Trace.TraceError($"{DateTime.Now.ToString("s")} SPTrust: is null"); @@ -127,7 +128,6 @@ public static void InitializeSiteCollection() { Trace.TraceError($"{DateTime.Now.ToString("s")} Web application was NOT found."); } - } [OneTimeTearDown] @@ -160,18 +160,29 @@ public static void InitializeConfiguration(LDAPCPConfig config) /// public static void TestSearchOperation(string inputValue, int expectedCount, string expectedClaimValue) { - string[] entityTypes = new string[] { "User", "SecGroup", "SharePointGroup", "System", "FormsRole" }; + try + { + Stopwatch timer = new Stopwatch(); + timer.Start(); + string[] entityTypes = new string[] { "User", "SecGroup", "SharePointGroup", "System", "FormsRole" }; + + SPProviderHierarchyTree providerResults = ClaimsProvider.Search(TestSiteCollUri, entityTypes, inputValue, null, 30); + List entities = new List(); + foreach (var children in providerResults.Children) + { + entities.AddRange(children.EntityData); + } + VerifySearchTest(entities, inputValue, expectedCount, expectedClaimValue); - SPProviderHierarchyTree providerResults = ClaimsProvider.Search(TestSiteCollUri, entityTypes, inputValue, null, 30); - List entities = new List(); - foreach (var children in providerResults.Children) + entities = ClaimsProvider.Resolve(TestSiteCollUri, entityTypes, inputValue).ToList(); + VerifySearchTest(entities, inputValue, expectedCount, expectedClaimValue); + timer.Stop(); + Trace.WriteLine($"{DateTime.Now.ToString("s")} TestSearchOperation finished in {timer.ElapsedMilliseconds} ms. Parameters: inputValue: '{inputValue}', expectedCount: '{expectedCount}', expectedClaimValue: '{expectedClaimValue}'."); + } + catch (Exception ex) { - entities.AddRange(children.EntityData); + Trace.TraceError($"{DateTime.Now.ToString("s")} TestSearchOperation failed with exception '{ex.GetType()}', message '{ex.Message}'. Parameters: inputValue: '{inputValue}', expectedCount: '{expectedCount}', expectedClaimValue: '{expectedClaimValue}'."); } - VerifySearchTest(entities, inputValue, expectedCount, expectedClaimValue); - - entities = ClaimsProvider.Resolve(TestSiteCollUri, entityTypes, inputValue).ToList(); - VerifySearchTest(entities, inputValue, expectedCount, expectedClaimValue); } public static void VerifySearchTest(List entities, string input, int expectedCount, string expectedClaimValue) @@ -203,42 +214,60 @@ public static void VerifySearchTest(List entities, string input, i public static void TestValidationOperation(SPClaim inputClaim, bool shouldValidate, string expectedClaimValue) { - string[] entityTypes = new string[] { "User" }; + try + { + Stopwatch timer = new Stopwatch(); + timer.Start(); + var entityTypes = new[] { "User" }; - PickerEntity[] entities = ClaimsProvider.Resolve(TestSiteCollUri, entityTypes, inputClaim); + PickerEntity[] entities = ClaimsProvider.Resolve(TestSiteCollUri, entityTypes, inputClaim); - int expectedCount = shouldValidate ? 1 : 0; - Assert.AreEqual(expectedCount, entities.Length, $"Validation of entity \"{inputClaim.Value}\" should have returned {expectedCount} entity, but it returned {entities.Length} instead."); - if (shouldValidate) + int expectedCount = shouldValidate ? 1 : 0; + Assert.AreEqual(expectedCount, entities.Length, $"Validation of entity \"{inputClaim.Value}\" should have returned {expectedCount} entity, but it returned {entities.Length} instead."); + if (shouldValidate) + { + StringAssert.AreEqualIgnoringCase(expectedClaimValue, entities[0].Claim.Value, $"Validation of entity \"{inputClaim.Value}\" should have returned value \"{expectedClaimValue}\", but it returned \"{entities[0].Claim.Value}\" instead."); + } + timer.Stop(); + Trace.WriteLine($"{DateTime.Now.ToString("s")} TestValidationOperation finished in {timer.ElapsedMilliseconds} ms. Parameters: inputClaim.Value: '{inputClaim.Value}', shouldValidate: '{shouldValidate}', expectedClaimValue: '{expectedClaimValue}'."); + } + catch (Exception ex) { - StringAssert.AreEqualIgnoringCase(expectedClaimValue, entities[0].Claim.Value, $"Validation of entity \"{inputClaim.Value}\" should have returned value \"{expectedClaimValue}\", but it returned \"{entities[0].Claim.Value}\" instead."); + Trace.TraceError($"{DateTime.Now.ToString("s")} TestValidationOperation failed with exception '{ex.GetType()}', message '{ex.Message}'. Parameters: inputClaim.Value: '{inputClaim.Value}', shouldValidate: '{shouldValidate}', expectedClaimValue: '{expectedClaimValue}'."); } } public static void TestAugmentationOperation(string claimType, string claimValue, bool isMemberOfTrustedGroup) { - SPClaim inputClaim = new SPClaim(claimType, claimValue, ClaimValueTypes.String, SPOriginalIssuers.Format(SPOriginalIssuerType.TrustedProvider, UnitTestsHelper.SPTrust.Name)); - Uri context = new Uri(TestSiteCollUri.AbsoluteUri); - SPClaim[] groups = ClaimsProvider.GetClaimsForEntity(context, inputClaim); - bool groupFound = false; - string groupsValueText = "No group was returned by the claims provider."; - - if (groups != null && groups.Count() > 0) + try { - groupsValueText = $"Claims provider returned those {groups.Count()} groups: {string.Join(", ", Array.ConvertAll(groups, x => x.Value))}"; - if (groups.Contains(TrustedGroup)) + Stopwatch timer = new Stopwatch(); + timer.Start(); + SPClaim inputClaim = new SPClaim(claimType, claimValue, ClaimValueTypes.String, SPOriginalIssuers.Format(SPOriginalIssuerType.TrustedProvider, UnitTestsHelper.SPTrust.Name)); + Uri context = new Uri(UnitTestsHelper.TestSiteCollUri.AbsoluteUri); + + SPClaim[] groups = ClaimsProvider.GetClaimsForEntity(context, inputClaim); + + bool groupFound = false; + if (groups != null && groups.Contains(TrustedGroup)) { groupFound = true; } - } - if (isMemberOfTrustedGroup) - { - Assert.IsTrue(groupFound, $"Entity \"{claimValue}\" should be member of group \"{TrustedGroupToAdd_ClaimValue}\", but this group was not found in the claims returned by the claims provider. {groupsValueText}"); + if (isMemberOfTrustedGroup) + { + Assert.IsTrue(groupFound, $"Entity \"{claimValue}\" should be member of group \"{TrustedGroupToAdd_ClaimValue}\", but this group was not found in the claims returned by the claims provider."); + } + else + { + Assert.IsFalse(groupFound, $"Entity \"{claimValue}\" should NOT be member of group \"{TrustedGroupToAdd_ClaimValue}\", but this group was found in the claims returned by the claims provider."); + } + timer.Stop(); + Trace.WriteLine($"{DateTime.Now.ToString("s")} TestAugmentationOperation finished in {timer.ElapsedMilliseconds} ms. Parameters: claimType: '{claimType}', claimValue: '{claimValue}', isMemberOfTrustedGroup: '{isMemberOfTrustedGroup}'."); } - else + catch (Exception ex) { - Assert.IsFalse(groupFound, $"Entity \"{claimValue}\" should NOT be member of group \"{TrustedGroupToAdd_ClaimValue}\", but this group was found in the claims returned by the claims provider. {groupsValueText}"); + Trace.TraceError($"{DateTime.Now.ToString("s")} TestAugmentationOperation failed with exception '{ex.GetType()}', message '{ex.Message}'. Parameters: claimType: '{claimType}', claimValue: '{claimValue}', isMemberOfTrustedGroup: '{isMemberOfTrustedGroup}'."); } } } diff --git a/LDAPCP/ADMIN/LDAPCP/ClaimTypesConfig.ascx.cs b/LDAPCP/ADMIN/LDAPCP/ClaimTypesConfig.ascx.cs index 27aade8..adf0f92 100644 --- a/LDAPCP/ADMIN/LDAPCP/ClaimTypesConfig.ascx.cs +++ b/LDAPCP/ADMIN/LDAPCP/ClaimTypesConfig.ascx.cs @@ -58,7 +58,9 @@ private void Initialize() Type EntityDataKeysInfo = typeof(PeopleEditorEntityDataKeys); foreach (object field in EntityDataKeysInfo.GetFields()) { - DdlNewEntityMetadata.Items.Add(((FieldInfo)field).Name); + FieldInfo fi = (FieldInfo)field; + object fieldValue = fi.GetValue(null); + DdlNewEntityMetadata.Items.Add(fieldValue.ToString()); } // Populate EntityType DDL diff --git a/LDAPCP/ADMIN/LDAPCP/ClaimTypesConfig.aspx b/LDAPCP/ADMIN/LDAPCP/ClaimTypesConfig.aspx index 42e7ac6..5880f9e 100644 --- a/LDAPCP/ADMIN/LDAPCP/ClaimTypesConfig.aspx +++ b/LDAPCP/ADMIN/LDAPCP/ClaimTypesConfig.aspx @@ -11,7 +11,7 @@ Claim types configuration for LDAPCP -<%= String.Format("LDAPCP v{0} - LDAPCP.com", FileVersionInfo.GetVersionInfo(Assembly.GetAssembly(typeof(LDAPCP)).Location).FileVersion, ClaimsProviderConstants.PUBLICSITEURL) %> + <%= String.Format("LDAPCP {0} - LDAPCP.com", FileVersionInfo.GetVersionInfo(Assembly.GetAssembly(typeof(LDAPCP)).Location).FileVersion, ClaimsProviderConstants.PUBLICSITEURL) %> diff --git a/LDAPCP/ADMIN/LDAPCP/GlobalSettings.ascx b/LDAPCP/ADMIN/LDAPCP/GlobalSettings.ascx index 185c782..b842243 100644 --- a/LDAPCP/ADMIN/LDAPCP/GlobalSettings.ascx +++ b/LDAPCP/ADMIN/LDAPCP/GlobalSettings.ascx @@ -166,9 +166,9 @@ - + - + - + - +

@@ -348,7 +348,7 @@
--%> - + @@ -361,7 +361,7 @@

- + diff --git a/LDAPCP/ADMIN/LDAPCP/GlobalSettings.ascx.cs b/LDAPCP/ADMIN/LDAPCP/GlobalSettings.ascx.cs index 93d3def..94d44d5 100644 --- a/LDAPCP/ADMIN/LDAPCP/GlobalSettings.ascx.cs +++ b/LDAPCP/ADMIN/LDAPCP/GlobalSettings.ascx.cs @@ -330,7 +330,13 @@ void AddLdapConnection() if (this.RbUseServerDomain.Checked) { - PersistedObject.LDAPConnectionsProp.Add(new LDAPConnection { UseSPServerConnectionToAD = true }); + PersistedObject.LDAPConnectionsProp.Add( + new LDAPConnection + { + UseSPServerConnectionToAD = true , + EnableAugmentation = true, + } + ); } else { @@ -343,6 +349,7 @@ void AddLdapConnection() LDAPUsername = this.TxtLdapUsername.Text, LDAPPassword = this.TxtLdapPassword.Text, AuthenticationSettings = authNType, + EnableAugmentation = true, } ); } diff --git a/LDAPCP/LDAPCP.AdminLinks/Elements.xml b/LDAPCP/LDAPCP.AdminLinks/Elements.xml index 796c7a2..8cc3681 100644 --- a/LDAPCP/LDAPCP.AdminLinks/Elements.xml +++ b/LDAPCP/LDAPCP.AdminLinks/Elements.xml @@ -25,4 +25,13 @@ Sequence="20"> + + + + diff --git a/LDAPCP/LDAPCP.cs b/LDAPCP/LDAPCP.cs index 63c7365..affefb5 100644 --- a/LDAPCP/LDAPCP.cs +++ b/LDAPCP/LDAPCP.cs @@ -1365,7 +1365,25 @@ protected virtual List GetGroupsFromActiveDirectory(LDAPConnection ldap foreach (Principal adGroup in adGroups) { string groupDomainName, groupDomainFqdn; - string claimValue = adGroup.Name; + + // https://github.com/Yvand/LDAPCP/issues/148 - the group property used for the group value should be based on the LDAPCP configuration + // By default it should be the SamAccountName, since it's also the default attribute set in LDAPCP configuration + string claimValue = adGroup.SamAccountName; + switch (groupCTConfig.LDAPAttribute.ToLower()) + { + case "name": + claimValue = adGroup.Name; + break; + + case "distinguishedname": + claimValue = adGroup.DistinguishedName; + break; + + case "samaccountname": + claimValue = adGroup.SamAccountName; + break; + } + if (!String.IsNullOrEmpty(groupCTConfig.ClaimValuePrefix)) { // Principal.DistinguishedName is used to build the domain name / FQDN of the current group. Example of value: CN=group1,CN=Users,DC=contoso,DC=local @@ -1375,11 +1393,11 @@ protected virtual List GetGroupsFromActiveDirectory(LDAPConnection ldap OperationContext.GetDomainInformation(groupDN, out groupDomainName, out groupDomainFqdn); if (groupCTConfig.ClaimValuePrefix.Contains(ClaimsProviderConstants.LDAPCPCONFIG_TOKENDOMAINNAME)) { - claimValue = groupCTConfig.ClaimValuePrefix.Replace(ClaimsProviderConstants.LDAPCPCONFIG_TOKENDOMAINNAME, groupDomainName) + adGroup.Name; + claimValue = groupCTConfig.ClaimValuePrefix.Replace(ClaimsProviderConstants.LDAPCPCONFIG_TOKENDOMAINNAME, groupDomainName) + claimValue; } else if (groupCTConfig.ClaimValuePrefix.Contains(ClaimsProviderConstants.LDAPCPCONFIG_TOKENDOMAINFQDN)) { - claimValue = groupCTConfig.ClaimValuePrefix.Replace(ClaimsProviderConstants.LDAPCPCONFIG_TOKENDOMAINFQDN, groupDomainFqdn) + adGroup.Name; + claimValue = groupCTConfig.ClaimValuePrefix.Replace(ClaimsProviderConstants.LDAPCPCONFIG_TOKENDOMAINFQDN, groupDomainFqdn) + claimValue; } } diff --git a/LDAPCP/LDAPCP.csproj b/LDAPCP/LDAPCP.csproj index 01f555b..d74b886 100644 --- a/LDAPCP/LDAPCP.csproj +++ b/LDAPCP/LDAPCP.csproj @@ -134,6 +134,6 @@ - "C:\Program Files (x86)\Microsoft SDKs\Windows\v10.0A\bin\NETFX 4.7.2 Tools\x64\gacutil.exe" /f /i "$(TargetPath)" + "C:\Program Files (x86)\Microsoft SDKs\Windows\v10.0A\bin\NETFX 4.8 Tools\x64\gacutil.exe" /f /i "$(TargetPath)" \ No newline at end of file diff --git a/LDAPCP/LDAPCPConfig.cs b/LDAPCP/LDAPCPConfig.cs index d9ed608..7d6d84c 100644 --- a/LDAPCP/LDAPCPConfig.cs +++ b/LDAPCP/LDAPCPConfig.cs @@ -598,7 +598,10 @@ public static List ReturnDefaultLDAPConnection() { return new List { - new LDAPConnection{UseSPServerConnectionToAD = true} + new LDAPConnection{ + UseSPServerConnectionToAD = true, + EnableAugmentation = true, + } }; } @@ -1247,10 +1250,11 @@ public static void GetDomainInformation(string distinguishedName, out string dom { StringBuilder sbDomainFQDN = new StringBuilder(); domainName = String.Empty; - if (distinguishedName.Contains("DC=")) + // String search in distinguishedName should not be case sensitive - https://github.com/Yvand/LDAPCP/issues/147 + if (distinguishedName.IndexOf("DC=", StringComparison.InvariantCultureIgnoreCase) >= 0) { int start = distinguishedName.IndexOf("DC=", StringComparison.InvariantCultureIgnoreCase); - string[] dnSplitted = distinguishedName.Substring(start).Split(new string[] { "DC=" }, StringSplitOptions.RemoveEmptyEntries); + string[] dnSplitted = distinguishedName.Substring(start).ToLower().Split(new string[] { "dc=" }, StringSplitOptions.RemoveEmptyEntries); bool setDomainName = true; foreach (string dc in dnSplitted) { diff --git a/azure-pipelines.yml b/azure-pipelines.yml deleted file mode 100644 index 7a79e10..0000000 --- a/azure-pipelines.yml +++ /dev/null @@ -1,398 +0,0 @@ -name: $(BuildVersion).$(date:yyyyMMdd).$(Build.BuildId) -resources: -- repo: self -variables: - BuildPlatform: 'Any CPU' - SolutionFileName: 'LDAPCP.sln' - ProductDescription: 'This claims provider connects SharePoint with Active Directory and LDAP servers to provide a great search experience in the people picker with federated authentication' -jobs: -- job: Compile - strategy: - maxParallel: 2 - matrix: - debugJob: - configuration: debug - platform: $(BuildPlatform) - releaseJob: - configuration: release - platform: $(BuildPlatform) - displayName: Compile - pool: - name: Hosted VS2017 - demands: - - msbuild - - visualstudio - - azureps - steps: - - task: DownloadSecureFile@1 - displayName: 'Download signing key' - inputs: - secureFile: '$(SigningKeySecureFileID)' - - - powershell: | - # Set variables - $azureStorageBaseDirectory = "Resources\$(system.teamProject)" - $projectLocalPath = "$(System.DefaultWorkingDirectory)\$(system.teamProject)" - $devTestLabsLocalPath = "$(Build.ArtifactStagingDirectory)\DevTestLabs" - $buildResourcesLocalPath = "$(Build.ArtifactStagingDirectory)\BuildPipeline" - - # Create the DevTestLabs directory if it doesn't exist - if ((Test-Path -Path $devTestLabsLocalPath -PathType Container) -eq $false) { - New-Item -ItemType Directory -Path $devTestLabsLocalPath - } - - # Create the Build pipeline directory if it doesn't exist - if ((Test-Path -Path $buildResourcesLocalPath -PathType Container) -eq $false) { - New-Item -ItemType Directory -Path $buildResourcesLocalPath - } - - Write-Output ("Copy files to build $(system.teamProject) from Azure storage account") - $azureContext = New-AzureStorageContext $(AzureStorageAccountName) $(AzureStorageAccountKey) - $azureShare = Get-AzureStorageShare $(AzureStorageShareName) –Context $azureContext - #Get-AzureStorageFileContent –Share $azureShare –Path "$azureStorageBaseDirectory\$(system.teamProject).snk" "$projectLocalPath\$(system.teamProject).snk" - Write-Output ("Copy signing key from $(DownloadSecureFile.secureFilePath) to $projectLocalPath") - Copy-Item "$(DownloadSecureFile.secureFilePath)" -Destination "$projectLocalPath" - Get-AzureStorageFileContent –Share $azureShare –Path "$azureStorageBaseDirectory\SharePoint 2013\Microsoft.SharePoint.dll" "$projectLocalPath\Microsoft.SharePoint.dll" - - Write-Output ("Copy DevTestLabs content from Azure storage account") - $azurePath = Join-Path -Path $azureStorageBaseDirectory -ChildPath "DevTestLabs" - Get-AzureStorageFile -ShareName $(AzureStorageShareName) -Context $azureContext -Path $azurePath | Get-AzureStorageFile | ?{$_.GetType().Name -eq "CloudFile"} | Get-AzureStorageFileContent -Destination $devTestLabsLocalPath - - Write-Output ("Copy BuildResources content from Azure storage account") - $azurePath = Join-Path -Path $azureStorageBaseDirectory -ChildPath "BuildPipeline" - Get-AzureStorageFile -ShareName $(AzureStorageShareName) -Context $azureContext -Path $azurePath | Get-AzureStorageFile | ? {$_.GetType().Name -eq "CloudFile"} | Get-AzureStorageFileContent -Destination $buildResourcesLocalPath - - Write-Output ("Add assembly Microsoft.SharePoint.dll to the GAC") - [System.Reflection.Assembly]::Load("System.EnterpriseServices, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a") - $publish = New-Object System.EnterpriseServices.Internal.Publish - $publish.GacInstall("$projectLocalPath\Microsoft.SharePoint.dll") - - displayName: 'Import resources from Azure storage account' - - task: NuGetToolInstaller@0 - displayName: 'Use NuGet 4.4.1' - inputs: - versionSpec: 4.4.1 - - - task: NuGetCommand@2 - displayName: 'NuGet restore' - inputs: - restoreSolution: '$(SolutionFileName)' - - - task: bleddynrichards.Assembly-Info-Task.Assembly-Info-Task.Assembly-Info-NetFramework@2 - displayName: 'Set $(system.teamProject) assemblies manifest' - inputs: - FileNames: '**\AssemblyInfo.cs' - Title: $(system.teamProject) - Product: $(system.teamProject) - Description: '$(ProductDescription)' - Company: GitHub.com/Yvand - Copyright: 'Copyright © $(date:YYYY) Yvan Duhamel, All rights reserved' - Trademark: '$(system.teamProject)' - VersionNumber: 1.0.0.0 - FileVersionNumber: '$(Build.BuildNumber)' - InformationalVersion: '$(Build.BuildNumber)' - - - task: VSBuild@1 - displayName: 'Build $(system.teamProject) solution' - inputs: - solution: '$(SolutionFileName)' - msbuildArgs: '/p:IsPackaging=true' - platform: '$(BuildPlatform)' - configuration: '$(configuration)' - msbuildArchitecture: x64 - - - task: CopyFiles@2 - displayName: 'Copy binaries to artifacts' - inputs: - SourceFolder: '$(Build.SourcesDirectory)' - Contents: | - $(system.teamProject)/bin/$(configuration)/?($(system.teamProject).*) - $(system.teamProject).Tests/bin/$(configuration)/?(*.dll) - TargetFolder: '$(Build.ArtifactStagingDirectory)' - - - task: PublishBuildArtifacts@1 - displayName: 'Publish Artifact: drop' - inputs: - pathtoPublish: '$(Build.ArtifactStagingDirectory)' - artifactName: drop - -- job: CreateTestEnvironment - displayName: Create test environment - timeoutInMinutes: 90 - pool: - name: Hosted VS2017 - steps: - - checkout: none #skip checking out the default repository resource - - task: ms-azuredevtestlabs.tasks.azure-dtl-task-createEnvironment.AzureDevTestLabsCreateEnvironment@1 - displayName: 'Create Azure DevTest Labs Environment' - inputs: - ConnectedServiceName: '$(Test.AzureConnectionName)' - LabId: '/subscriptions/$(Test.AzureSubscriptionId)/resourceGroups/$(Test.DevTestLabName)/providers/Microsoft.DevTestLab/labs/$(Test.DevTestLabName)' - RepositoryId: '/subscriptions/$(Test.AzureSubscriptionId)/resourcegroups/$(Test.DevTestLabName)/providers/microsoft.devtestlab/labs/$(Test.DevTestLabName)/artifactsources/privaterepo897' - TemplateId: '/subscriptions/$(Test.AzureSubscriptionId)/resourceGroups/$(Test.DevTestLabName)/providers/Microsoft.DevTestLab/labs/$(Test.DevTestLabName)/artifactSources/privaterepo897/armTemplates/SharePoint-ADFS-DevTestLabs' - EnvironmentName: 'IntegrationTests' - ParameterOverrides: "-location 'west europe' -provisionSharePoint2013 '$(Test.ProvisionSharePoint2013)' -provisionSharePoint2016 '$(Test.ProvisionSharePoint2016)' -provisionSharePoint2019 '$(Test.ProvisionSharePoint2019)' -enableHybridBenefitServerLicenses 'Yes' -adminUserName '$(Test.AdminUserName)' -adminPassword '$(Test.AdminPassword)' -serviceAccountsPassword '$(Test.ServiceAccountsPassword)'" - TemplateOutputVariables: true - ExportEnvironmentTemplate: true - timeoutInMinutes: 90 - -- job: ApplyArtifactsSP2013 - condition: and(succeeded(), eq(variables['Test.ProvisionSharePoint2013'], 'yes')) - dependsOn: - - Compile - - CreateTestEnvironment - displayName: Apply artifacts on SP2013 - timeoutInMinutes: 30 - variables: - jobSharePointVersion: 2013 - pool: - name: Hosted VS2017 - steps: - - checkout: none #skip checking out the default repository resource - - task: DownloadBuildArtifacts@0 - displayName: 'Download Build Artifacts' - inputs: - artifactName: drop - downloadPath: $(Build.ArtifactStagingDirectory) - - - task: AzurePowerShell@3 - displayName: 'Apply artifact 7-zip' - inputs: - azureSubscription: '$(Test.AzureConnectionName)' - ScriptPath: '$(Build.ArtifactStagingDirectory)\drop\BuildPipeline\DevTestLab_ApplyArtifact.ps1' - ScriptArguments: '-DevTestLabName "$(Test.DevTestLabName)" -VirtualMachineName "SP$(jobSharePointVersion)" -RepositoryName "Public Repo" -ArtifactName "windows-7zip"' - preferredAzurePowerShellVersion: 5.1.1 - enabled: false - - - task: AzurePowerShell@3 - displayName: 'Apply artifact "Azure Pipelines Agent"' - inputs: - azureSubscription: '$(Test.AzureConnectionName)' - ScriptPath: '$(Build.ArtifactStagingDirectory)\drop\BuildPipeline\DevTestLab_ApplyArtifact.ps1' - ScriptArguments: '-DevTestLabName "$(Test.DevTestLabName)" -VirtualMachineName "SP$(jobSharePointVersion)" -RepositoryName "Yvand/AzureRM-Templates" -ArtifactName "windows-vsts-build-agent" -param_vstsAccount "$(Test.DevOpsOrganizationName)" -param_vstsPassword "$(AccessTokenDevOpsYvand)" -param_poolName "$(system.teamProject)-Tests-$(jobSharePointVersion)" -param_windowsLogonAccount "$(Test.Domain)\$(Test.AdminUserName)" -param_windowsLogonPassword "$(Test.AdminPassword)" -param_agentName "SP$(jobSharePointVersion)" -param_agentNameSuffix "-$(Build.BuildNumber)" -param_RunAsAutoLogon false -param_driveLetter C -param_workDirectory ""' - preferredAzurePowerShellVersion: 5.1.1 - - - task: AzurePowerShell@3 - displayName: 'Apply artifact "Download Azure Pipelines Artifact and Run Script"' - inputs: - azureSubscription: '$(Test.AzureConnectionName)' - ScriptPath: '$(Build.ArtifactStagingDirectory)\drop\BuildPipeline\DevTestLab_ApplyArtifact.ps1' - ScriptArguments: -DevTestLabName '$(Test.DevTestLabName)' -VirtualMachineName 'SP$(jobSharePointVersion)' -RepositoryName 'Yvand/AzureRM-Templates' -ArtifactName 'windows-vsts-download-and-run-script' -param_vstsProjectUri 'https://dev.azure.com/$(Test.DevOpsOrganizationName)/$(system.teamProject)' -param_buildDefinitionName '$(Build.DefinitionName)' -param_personalAccessToken $(AccessTokenDevOpsYvand) -param_pathToScript 'drop\SPTestServer artifacts\ConfigureLab.ps1' -param_scriptArguments "-pathToPackage ''..\$(system.teamProject)\bin\$(BuildConfiguration)\$(system.teamProject).wsp' -claimsProviderName '$(system.teamProject)' -spTrustName '$(Test.DomainFQDN)' -adminUserName '$(Test.Domain)\$(Test.AdminUserName)' -adminPassword '$(Test.AdminPassword)'" - preferredAzurePowerShellVersion: 5.1.1 - - - task: ms-azuredevtestlabs.tasks.azure-dtl-task-deleteEnvironment.AzureDevTestLabsDeleteEnvironment@1 - displayName: 'Delete Azure DevTest Labs deployed in previous task' - inputs: - ConnectedServiceName: '$(Test.AzureConnectionName)' - LabId: '/subscriptions/$(Test.AzureSubscriptionId)/resourceGroups/$(Test.DevTestLabName)/providers/Microsoft.DevTestLab/labs/$(Test.DevTestLabName)' - EnvironmentId: '$(BaseEnv.environmentResourceId)' - enabled: false - -- job: ApplyArtifactsSP2016 - condition: and(succeeded(), eq(variables['Test.ProvisionSharePoint2016'], 'yes')) - dependsOn: - - Compile - - CreateTestEnvironment - displayName: Apply artifacts on SP2016 - timeoutInMinutes: 30 - variables: - jobSharePointVersion: 2016 - pool: - name: Hosted VS2017 - steps: - - checkout: none #skip checking out the default repository resource - - task: DownloadBuildArtifacts@0 - displayName: 'Download Build Artifacts' - inputs: - artifactName: drop - downloadPath: $(Build.ArtifactStagingDirectory) - - - task: AzurePowerShell@3 - displayName: 'Apply artifact 7-zip' - inputs: - azureSubscription: '$(Test.AzureConnectionName)' - ScriptPath: '$(Build.ArtifactStagingDirectory)\drop\BuildPipeline\DevTestLab_ApplyArtifact.ps1' - ScriptArguments: '-DevTestLabName "$(Test.DevTestLabName)" -VirtualMachineName "SP$(jobSharePointVersion)" -RepositoryName "Public Repo" -ArtifactName "windows-7zip"' - preferredAzurePowerShellVersion: 5.1.1 - enabled: false - - - task: AzurePowerShell@3 - displayName: 'Apply artifact "Azure Pipelines Agent"' - inputs: - azureSubscription: '$(Test.AzureConnectionName)' - ScriptPath: '$(Build.ArtifactStagingDirectory)\drop\BuildPipeline\DevTestLab_ApplyArtifact.ps1' - ScriptArguments: '-DevTestLabName "$(Test.DevTestLabName)" -VirtualMachineName "SP$(jobSharePointVersion)" -RepositoryName "Yvand/AzureRM-Templates" -ArtifactName "windows-vsts-build-agent" -param_vstsAccount "$(Test.DevOpsOrganizationName)" -param_vstsPassword "$(AccessTokenDevOpsYvand)" -param_poolName "$(system.teamProject)-Tests-$(jobSharePointVersion)" -param_windowsLogonAccount "$(Test.Domain)\$(Test.AdminUserName)" -param_windowsLogonPassword "$(Test.AdminPassword)" -param_agentName "SP$(jobSharePointVersion)" -param_agentNameSuffix "-$(Build.BuildNumber)" -param_RunAsAutoLogon false -param_driveLetter C -param_workDirectory ""' - preferredAzurePowerShellVersion: 5.1.1 - - - task: AzurePowerShell@3 - displayName: 'Apply artifact "Download Azure Pipelines Artifact and Run Script"' - inputs: - azureSubscription: '$(Test.AzureConnectionName)' - ScriptPath: '$(Build.ArtifactStagingDirectory)\drop\BuildPipeline\DevTestLab_ApplyArtifact.ps1' - ScriptArguments: -DevTestLabName '$(Test.DevTestLabName)' -VirtualMachineName 'SP$(jobSharePointVersion)' -RepositoryName 'Yvand/AzureRM-Templates' -ArtifactName 'windows-vsts-download-and-run-script' -param_vstsProjectUri 'https://dev.azure.com/$(Test.DevOpsOrganizationName)/$(system.teamProject)' -param_buildDefinitionName '$(Build.DefinitionName)' -param_personalAccessToken $(AccessTokenDevOpsYvand) -param_pathToScript 'drop\SPTestServer artifacts\ConfigureLab.ps1' -param_scriptArguments "-pathToPackage ''..\$(system.teamProject)\bin\$(BuildConfiguration)\$(system.teamProject).wsp' -claimsProviderName '$(system.teamProject)' -spTrustName '$(Test.DomainFQDN)' -adminUserName '$(Test.Domain)\$(Test.AdminUserName)' -adminPassword '$(Test.AdminPassword)'" - preferredAzurePowerShellVersion: 5.1.1 - - - task: ms-azuredevtestlabs.tasks.azure-dtl-task-deleteEnvironment.AzureDevTestLabsDeleteEnvironment@1 - displayName: 'Delete Azure DevTest Labs deployed in previous task' - inputs: - ConnectedServiceName: '$(Test.AzureConnectionName)' - LabId: '/subscriptions/$(Test.AzureSubscriptionId)/resourceGroups/$(Test.DevTestLabName)/providers/Microsoft.DevTestLab/labs/$(Test.DevTestLabName)' - EnvironmentId: '$(BaseEnv.environmentResourceId)' - enabled: false - -- job: ApplyArtifactsSP2019 - condition: and(succeeded(), eq(variables['Test.ProvisionSharePoint2019'], 'yes')) - dependsOn: - - Compile - - CreateTestEnvironment - displayName: Apply artifacts on SP2019 - timeoutInMinutes: 30 - variables: - jobSharePointVersion: 2019 - pool: - name: Hosted VS2017 - steps: - - checkout: none #skip checking out the default repository resource - - task: DownloadBuildArtifacts@0 - displayName: 'Download Build Artifacts' - inputs: - artifactName: drop - downloadPath: $(Build.ArtifactStagingDirectory) - - - task: AzurePowerShell@3 - displayName: 'Apply artifact 7-zip' - inputs: - azureSubscription: '$(Test.AzureConnectionName)' - ScriptPath: '$(Build.ArtifactStagingDirectory)\drop\BuildPipeline\DevTestLab_ApplyArtifact.ps1' - ScriptArguments: '-DevTestLabName "$(Test.DevTestLabName)" -VirtualMachineName "SP$(jobSharePointVersion)" -RepositoryName "Public Repo" -ArtifactName "windows-7zip"' - preferredAzurePowerShellVersion: 5.1.1 - enabled: false - - - task: AzurePowerShell@3 - displayName: 'Apply artifact "Azure Pipelines Agent"' - inputs: - azureSubscription: '$(Test.AzureConnectionName)' - ScriptPath: '$(Build.ArtifactStagingDirectory)\drop\BuildPipeline\DevTestLab_ApplyArtifact.ps1' - ScriptArguments: '-DevTestLabName "$(Test.DevTestLabName)" -VirtualMachineName "SP$(jobSharePointVersion)" -RepositoryName "Yvand/AzureRM-Templates" -ArtifactName "windows-vsts-build-agent" -param_vstsAccount "$(Test.DevOpsOrganizationName)" -param_vstsPassword "$(AccessTokenDevOpsYvand)" -param_poolName "$(system.teamProject)-Tests-$(jobSharePointVersion)" -param_windowsLogonAccount "$(Test.Domain)\$(Test.AdminUserName)" -param_windowsLogonPassword "$(Test.AdminPassword)" -param_agentName "SP$(jobSharePointVersion)" -param_agentNameSuffix "-$(Build.BuildNumber)" -param_RunAsAutoLogon false -param_driveLetter C -param_workDirectory ""' - preferredAzurePowerShellVersion: 5.1.1 - - - task: AzurePowerShell@3 - displayName: 'Apply artifact "Download Azure Pipelines Artifact and Run Script"' - inputs: - azureSubscription: '$(Test.AzureConnectionName)' - ScriptPath: '$(Build.ArtifactStagingDirectory)\drop\BuildPipeline\DevTestLab_ApplyArtifact.ps1' - ScriptArguments: -DevTestLabName '$(Test.DevTestLabName)' -VirtualMachineName 'SP$(jobSharePointVersion)' -RepositoryName 'Yvand/AzureRM-Templates' -ArtifactName 'windows-vsts-download-and-run-script' -param_vstsProjectUri 'https://dev.azure.com/$(Test.DevOpsOrganizationName)/$(system.teamProject)' -param_buildDefinitionName '$(Build.DefinitionName)' -param_personalAccessToken $(AccessTokenDevOpsYvand) -param_pathToScript 'drop\SPTestServer artifacts\ConfigureLab.ps1' -param_scriptArguments "-pathToPackage ''..\$(system.teamProject)\bin\$(BuildConfiguration)\$(system.teamProject).wsp' -claimsProviderName '$(system.teamProject)' -spTrustName '$(Test.DomainFQDN)' -adminUserName '$(Test.Domain)\$(Test.AdminUserName)' -adminPassword '$(Test.AdminPassword)'" - preferredAzurePowerShellVersion: 5.1.1 - - - task: ms-azuredevtestlabs.tasks.azure-dtl-task-deleteEnvironment.AzureDevTestLabsDeleteEnvironment@1 - displayName: 'Delete Azure DevTest Labs deployed in previous task' - inputs: - ConnectedServiceName: '$(Test.AzureConnectionName)' - LabId: '/subscriptions/$(Test.AzureSubscriptionId)/resourceGroups/$(Test.DevTestLabName)/providers/Microsoft.DevTestLab/labs/$(Test.DevTestLabName)' - EnvironmentId: '$(BaseEnv.environmentResourceId)' - enabled: false - -- job: RunTestSP2013 - dependsOn: ApplyArtifactsSP2013 - #dependsOn: Compile - displayName: Run tests on SP2013 - timeoutInMinutes: 15 - variables: - jobSharePointVersion: 2013 - pool: - name: LDAPCP-Tests-2013 - steps: - - task: DownloadBuildArtifacts@0 - displayName: 'Download Build Artifacts' - inputs: - artifactName: drop - downloadPath: $(Build.ArtifactStagingDirectory) - itemPattern: | - drop/LDAPCP.Tests/bin/Release/*.dll - drop/DevTestLabs/*.csv - - - task: VisualStudioTestPlatformInstaller@1 - displayName: 'Visual Studio Test Platform Installer' - - - task: VSTest@2 - displayName: 'Run Visual Studio tests' - inputs: - searchFolder: '$(System.ArtifactsDirectory)\drop' - vsTestVersion: toolsInstaller - runSettingsFile: LDAPCP.Tests/local.runsettings - overrideTestrunParameters: '-DataFile_AllAccounts_Search "$(System.ArtifactsDirectory)\drop\SPTestServer artifacts\LDAPCP_Tests_AllAccounts_Search.csv" -DataFile_AllAccounts_Validate "$(System.ArtifactsDirectory)\drop\SPTestServer artifacts\LDAPCP_Tests_AllAccounts_Validate.csv" -TestSiteCollectionName "LDAPCP.$(Build.BuildNumber)"' - codeCoverageEnabled: false - otherConsoleOptions: '/Platform:x64' - testRunTitle: 'LDAPCP-Tests-SP$(jobSharePointVersion)' - platform: '$(BuildPlatform)' - configuration: $(BuildConfiguration) - -- job: RunTestSP2016 - dependsOn: ApplyArtifactsSP2016 - #dependsOn: Compile - displayName: Run tests on SP2016 - timeoutInMinutes: 15 - variables: - jobSharePointVersion: 2016 - pool: - name: LDAPCP-Tests-2016 - steps: - - task: DownloadBuildArtifacts@0 - displayName: 'Download Build Artifacts' - inputs: - artifactName: drop - downloadPath: $(Build.ArtifactStagingDirectory) - itemPattern: | - drop/LDAPCP.Tests/bin/Release/*.dll - drop/DevTestLabs/*.csv - - - task: VisualStudioTestPlatformInstaller@1 - displayName: 'Visual Studio Test Platform Installer' - - - task: VSTest@2 - displayName: 'Run Visual Studio tests' - inputs: - searchFolder: '$(System.ArtifactsDirectory)\drop' - vsTestVersion: toolsInstaller - runSettingsFile: LDAPCP.Tests/local.runsettings - overrideTestrunParameters: '-DataFile_AllAccounts_Search "$(System.ArtifactsDirectory)\drop\SPTestServer artifacts\LDAPCP_Tests_AllAccounts_Search.csv" -DataFile_AllAccounts_Validate "$(System.ArtifactsDirectory)\drop\SPTestServer artifacts\LDAPCP_Tests_AllAccounts_Validate.csv" -TestSiteCollectionName "LDAPCP.$(Build.BuildNumber)"' - codeCoverageEnabled: false - otherConsoleOptions: '/Platform:x64' - testRunTitle: 'LDAPCP-Tests-SP$(jobSharePointVersion)' - platform: '$(BuildPlatform)' - configuration: $(BuildConfiguration) - -- job: RunTestSP2019 - dependsOn: ApplyArtifactsSP2019 - #dependsOn: Compile - displayName: Run tests on SP2019 - timeoutInMinutes: 15 - variables: - jobSharePointVersion: 2019 - pool: - name: LDAPCP-Tests-2019 - steps: - - task: DownloadBuildArtifacts@0 - displayName: 'Download Build Artifacts' - inputs: - artifactName: drop - downloadPath: $(Build.ArtifactStagingDirectory) - itemPattern: | - drop/LDAPCP.Tests/bin/Release/*.dll - drop/DevTestLabs/*.csv - - - task: VisualStudioTestPlatformInstaller@1 - displayName: 'Visual Studio Test Platform Installer' - - - task: VSTest@2 - displayName: 'Run Visual Studio tests' - inputs: - searchFolder: '$(System.ArtifactsDirectory)\drop' - vsTestVersion: toolsInstaller - runSettingsFile: LDAPCP.Tests/local.runsettings - overrideTestrunParameters: '-DataFile_AllAccounts_Search "$(System.ArtifactsDirectory)\drop\SPTestServer artifacts\LDAPCP_Tests_AllAccounts_Search.csv" -DataFile_AllAccounts_Validate "$(System.ArtifactsDirectory)\drop\SPTestServer artifacts\LDAPCP_Tests_AllAccounts_Validate.csv" -TestSiteCollectionName "LDAPCP.$(Build.BuildNumber)"' - codeCoverageEnabled: false - otherConsoleOptions: '/Platform:x64' - testRunTitle: 'LDAPCP-Tests-SP$(jobSharePointVersion)' - platform: '$(BuildPlatform)' - configuration: $(BuildConfiguration) diff --git a/DevOps-ApplyDTLArtifacts.yml b/azure-pipelines/ci-apply-dtl-artifacts.yml similarity index 60% rename from DevOps-ApplyDTLArtifacts.yml rename to azure-pipelines/ci-apply-dtl-artifacts.yml index e862aef..bbfb89e 100644 --- a/DevOps-ApplyDTLArtifacts.yml +++ b/azure-pipelines/ci-apply-dtl-artifacts.yml @@ -3,7 +3,7 @@ resources: jobs: - job: ApplyArtifactsSP2013 - condition: eq(variables['Deployment.ProvisionSharePoint2013'], 'yes') + condition: eq(variables['Deployment.ProvisionSharePoint2013'], true) displayName: Apply artifacts on SP2013 timeoutInMinutes: 30 variables: @@ -15,11 +15,11 @@ jobs: - task: automagically.DownloadFile.DownloadFile.DownloadFile@1 displayName: 'Download apply-dtl-artifact.ps1' inputs: - FileUrl: 'https://raw.githubusercontent.com/Yvand/AzureRM-Templates/dev/DevTestLabs-Artifacts/manage-artifacts/apply-dtl-artifact.ps1' + FileUrl: 'https://raw.githubusercontent.com/Yvand/AzureRM-Templates/master/DevTestLabs-Artifacts/manage-artifacts/apply-dtl-artifact.ps1' DestinationFolder: '$(System.DefaultWorkingDirectory)\scripts' - task: AzurePowerShell@3 - displayName: 'Apply artifact "Azure Pipelines Agent"' + displayName: 'Create and register a VSTS agent in DevOps agent pools by applying artifact "Azure Pipelines Agent"' inputs: azureSubscription: '$(DevTestLabs.AzureConnectionName)' ScriptPath: '$(System.DefaultWorkingDirectory)\scripts\apply-dtl-artifact.ps1' @@ -31,11 +31,11 @@ jobs: inputs: azureSubscription: '$(DevTestLabs.AzureConnectionName)' ScriptPath: '$(System.DefaultWorkingDirectory)\scripts\apply-dtl-artifact.ps1' - ScriptArguments: -DevTestLabName '$(DevTestLabs.LabName)' -VirtualMachineName 'SP$(jobSharePointVersion)' -RepositoryName 'Yvand/AzureRM-Templates' -ArtifactName 'windows-vsts-download-and-run-script' -param_vstsProjectUri 'https://dev.azure.com/$(DevOps.OrganizationName)/$(system.teamProject)' -param_buildDefinitionName '$(DevOps.BuildArtifactsPipelineName)' -param_personalAccessToken $(DevOps.AccessToken) -param_pathToScript 'drop_$(Tests.BuildConfiguration)\$(Deployment.ConfigureServerFolderName)\ConfigureLab.ps1' -param_scriptArguments "-pathToPackage ''..\$(system.teamProject)\bin\$(Tests.BuildConfiguration)\$(system.teamProject).wsp' -claimsProviderName '$(system.teamProject)' -spTrustName '$(Deployment.DomainFQDN)' -adminUserName '$(Deployment.DomainName)\$(Deployment.AdminUserName)' -adminPassword '$(Deployment.AdminPassword)'" + ScriptArguments: -DevTestLabName '$(DevTestLabs.LabName)' -VirtualMachineName 'SP$(jobSharePointVersion)' -RepositoryName 'Yvand/AzureRM-Templates' -ArtifactName 'windows-vsts-download-and-run-script' -param_vstsProjectUri 'https://dev.azure.com/$(DevOps.OrganizationName)/$(system.teamProject)' -param_buildDefinitionName '$(DevOps.BuildArtifactsPipelineName)' -param_personalAccessToken $(DevOps.AccessToken) -param_pathToScript 'drop_$(Tests.BuildConfiguration)\$(Deployment.ConfigureServerFolderName)\ConfigureLab.ps1' -param_scriptArguments "-pathToPackage '..\$(system.teamProject)\bin\$(Tests.BuildConfiguration)\$(system.teamProject).wsp' -claimsProviderName '$(system.teamProject)' -spTrustName '$(Deployment.DomainFQDN)' -adminUserName '$(Deployment.DomainName)\$(Deployment.AdminUserName)' -adminPassword '$(Deployment.AdminPassword)'" preferredAzurePowerShellVersion: 5.1.1 - job: ApplyArtifactsSP2016 - condition: eq(variables['Deployment.ProvisionSharePoint2016'], 'yes') + condition: eq(variables['Deployment.ProvisionSharePoint2016'], true) displayName: Apply artifacts on SP2016 timeoutInMinutes: 30 variables: @@ -47,11 +47,11 @@ jobs: - task: automagically.DownloadFile.DownloadFile.DownloadFile@1 displayName: 'Download apply-dtl-artifact.ps1' inputs: - FileUrl: 'https://raw.githubusercontent.com/Yvand/AzureRM-Templates/dev/DevTestLabs-Artifacts/manage-artifacts/apply-dtl-artifact.ps1' + FileUrl: 'https://raw.githubusercontent.com/Yvand/AzureRM-Templates/master/DevTestLabs-Artifacts/manage-artifacts/apply-dtl-artifact.ps1' DestinationFolder: '$(System.DefaultWorkingDirectory)\scripts' - task: AzurePowerShell@3 - displayName: 'Apply artifact "Azure Pipelines Agent"' + displayName: 'Create and register a VSTS agent in DevOps agent pools by applying artifact "Azure Pipelines Agent"' inputs: azureSubscription: '$(DevTestLabs.AzureConnectionName)' ScriptPath: '$(System.DefaultWorkingDirectory)\scripts\apply-dtl-artifact.ps1' @@ -63,11 +63,11 @@ jobs: inputs: azureSubscription: '$(DevTestLabs.AzureConnectionName)' ScriptPath: '$(System.DefaultWorkingDirectory)\scripts\apply-dtl-artifact.ps1' - ScriptArguments: -DevTestLabName '$(DevTestLabs.LabName)' -VirtualMachineName 'SP$(jobSharePointVersion)' -RepositoryName 'Yvand/AzureRM-Templates' -ArtifactName 'windows-vsts-download-and-run-script' -param_vstsProjectUri 'https://dev.azure.com/$(DevOps.OrganizationName)/$(system.teamProject)' -param_buildDefinitionName '$(DevOps.BuildArtifactsPipelineName)' -param_personalAccessToken $(DevOps.AccessToken) -param_pathToScript 'drop_$(Tests.BuildConfiguration)\$(Deployment.ConfigureServerFolderName)\ConfigureLab.ps1' -param_scriptArguments "-pathToPackage ''..\$(system.teamProject)\bin\$(Tests.BuildConfiguration)\$(system.teamProject).wsp' -claimsProviderName '$(system.teamProject)' -spTrustName '$(Deployment.DomainFQDN)' -adminUserName '$(Deployment.DomainName)\$(Deployment.AdminUserName)' -adminPassword '$(Deployment.AdminPassword)'" + ScriptArguments: -DevTestLabName '$(DevTestLabs.LabName)' -VirtualMachineName 'SP$(jobSharePointVersion)' -RepositoryName 'Yvand/AzureRM-Templates' -ArtifactName 'windows-vsts-download-and-run-script' -param_vstsProjectUri 'https://dev.azure.com/$(DevOps.OrganizationName)/$(system.teamProject)' -param_buildDefinitionName '$(DevOps.BuildArtifactsPipelineName)' -param_personalAccessToken $(DevOps.AccessToken) -param_pathToScript 'drop_$(Tests.BuildConfiguration)\$(Deployment.ConfigureServerFolderName)\ConfigureLab.ps1' -param_scriptArguments "-pathToPackage '..\$(system.teamProject)\bin\$(Tests.BuildConfiguration)\$(system.teamProject).wsp' -claimsProviderName '$(system.teamProject)' -spTrustName '$(Deployment.DomainFQDN)' -adminUserName '$(Deployment.DomainName)\$(Deployment.AdminUserName)' -adminPassword '$(Deployment.AdminPassword)'" preferredAzurePowerShellVersion: 5.1.1 - job: ApplyArtifactsSP2019 - condition: eq(variables['Deployment.ProvisionSharePoint2019'], 'yes') + condition: eq(variables['Deployment.ProvisionSharePoint2019'], true) displayName: Apply artifacts on SP2019 timeoutInMinutes: 30 variables: @@ -79,11 +79,11 @@ jobs: - task: automagically.DownloadFile.DownloadFile.DownloadFile@1 displayName: 'Download apply-dtl-artifact.ps1' inputs: - FileUrl: 'https://raw.githubusercontent.com/Yvand/AzureRM-Templates/dev/DevTestLabs-Artifacts/manage-artifacts/apply-dtl-artifact.ps1' + FileUrl: 'https://raw.githubusercontent.com/Yvand/AzureRM-Templates/master/DevTestLabs-Artifacts/manage-artifacts/apply-dtl-artifact.ps1' DestinationFolder: '$(System.DefaultWorkingDirectory)\scripts' - task: AzurePowerShell@3 - displayName: 'Apply artifact "Azure Pipelines Agent"' + displayName: 'Create and register a VSTS agent in DevOps agent pools by applying artifact "Azure Pipelines Agent"' inputs: azureSubscription: '$(DevTestLabs.AzureConnectionName)' ScriptPath: '$(System.DefaultWorkingDirectory)\scripts\apply-dtl-artifact.ps1' @@ -95,5 +95,37 @@ jobs: inputs: azureSubscription: '$(DevTestLabs.AzureConnectionName)' ScriptPath: '$(System.DefaultWorkingDirectory)\scripts\apply-dtl-artifact.ps1' - ScriptArguments: -DevTestLabName '$(DevTestLabs.LabName)' -VirtualMachineName 'SP$(jobSharePointVersion)' -RepositoryName 'Yvand/AzureRM-Templates' -ArtifactName 'windows-vsts-download-and-run-script' -param_vstsProjectUri 'https://dev.azure.com/$(DevOps.OrganizationName)/$(system.teamProject)' -param_buildDefinitionName '$(DevOps.BuildArtifactsPipelineName)' -param_personalAccessToken $(DevOps.AccessToken) -param_pathToScript 'drop_$(Tests.BuildConfiguration)\$(Deployment.ConfigureServerFolderName)\ConfigureLab.ps1' -param_scriptArguments "-pathToPackage ''..\$(system.teamProject)\bin\$(Tests.BuildConfiguration)\$(system.teamProject).wsp' -claimsProviderName '$(system.teamProject)' -spTrustName '$(Deployment.DomainFQDN)' -adminUserName '$(Deployment.DomainName)\$(Deployment.AdminUserName)' -adminPassword '$(Deployment.AdminPassword)'" + ScriptArguments: -DevTestLabName '$(DevTestLabs.LabName)' -VirtualMachineName 'SP$(jobSharePointVersion)' -RepositoryName 'Yvand/AzureRM-Templates' -ArtifactName 'windows-vsts-download-and-run-script' -param_vstsProjectUri 'https://dev.azure.com/$(DevOps.OrganizationName)/$(system.teamProject)' -param_buildDefinitionName '$(DevOps.BuildArtifactsPipelineName)' -param_personalAccessToken $(DevOps.AccessToken) -param_pathToScript 'drop_$(Tests.BuildConfiguration)\$(Deployment.ConfigureServerFolderName)\ConfigureLab.ps1' -param_scriptArguments "-pathToPackage '..\$(system.teamProject)\bin\$(Tests.BuildConfiguration)\$(system.teamProject).wsp' -claimsProviderName '$(system.teamProject)' -spTrustName '$(Deployment.DomainFQDN)' -adminUserName '$(Deployment.DomainName)\$(Deployment.AdminUserName)' -adminPassword '$(Deployment.AdminPassword)'" preferredAzurePowerShellVersion: 5.1.1 + +- job: ApplyArtifactsSPSubscription + condition: eq(variables['Deployment.ProvisionSharePointSubscription'], true) + displayName: Apply artifacts on SPSubscription + timeoutInMinutes: 30 + variables: + jobSharePointVersion: Subscription + pool: + vmImage: 'windows-latest' + steps: + - checkout: none #skip checking out the default repository resource + - task: automagically.DownloadFile.DownloadFile.DownloadFile@1 + displayName: 'Download apply-dtl-artifact.ps1' + inputs: + FileUrl: 'https://raw.githubusercontent.com/Yvand/AzureRM-Templates/master/DevTestLabs-Artifacts/manage-artifacts/apply-dtl-artifact.ps1' + DestinationFolder: '$(System.DefaultWorkingDirectory)\scripts' + + - task: AzurePowerShell@3 + displayName: 'Create and register a VSTS agent in DevOps agent pools by applying artifact "Azure Pipelines Agent"' + inputs: + azureSubscription: '$(DevTestLabs.AzureConnectionName)' + ScriptPath: '$(System.DefaultWorkingDirectory)\scripts\apply-dtl-artifact.ps1' + ScriptArguments: '-DevTestLabName "$(DevTestLabs.LabName)" -VirtualMachineName "SP$(jobSharePointVersion)" -RepositoryName "Yvand/AzureRM-Templates" -ArtifactName "windows-vsts-build-agent" -param_vstsAccount "$(DevOps.OrganizationName)" -param_vstsPassword "$(DevOps.AccessToken)" -param_poolName "$(system.teamProject)-Tests-$(jobSharePointVersion)" -param_windowsLogonAccount "$(Deployment.DomainName)\$(Deployment.AdminUserName)" -param_windowsLogonPassword "$(Deployment.AdminPassword)" -param_agentName "SP$(jobSharePointVersion)" -param_agentNameSuffix "-$(Build.BuildNumber)" -param_RunAsAutoLogon false -param_driveLetter C -param_workDirectory ""' + preferredAzurePowerShellVersion: 5.1.1 + + - task: AzurePowerShell@3 + displayName: 'Apply artifact "Download Azure Pipelines Artifact and Run Script"' + inputs: + azureSubscription: '$(DevTestLabs.AzureConnectionName)' + ScriptPath: '$(System.DefaultWorkingDirectory)\scripts\apply-dtl-artifact.ps1' + ScriptArguments: -DevTestLabName '$(DevTestLabs.LabName)' -VirtualMachineName 'SP$(jobSharePointVersion)' -RepositoryName 'Yvand/AzureRM-Templates' -ArtifactName 'windows-vsts-download-and-run-script' -param_vstsProjectUri 'https://dev.azure.com/$(DevOps.OrganizationName)/$(system.teamProject)' -param_buildDefinitionName '$(DevOps.BuildArtifactsPipelineName)' -param_personalAccessToken $(DevOps.AccessToken) -param_pathToScript 'drop_$(Tests.BuildConfiguration)\$(Deployment.ConfigureServerFolderName)\ConfigureLab.ps1' -param_scriptArguments "-pathToPackage '..\$(system.teamProject)\bin\$(Tests.BuildConfiguration)\$(system.teamProject).wsp' -claimsProviderName '$(system.teamProject)' -spTrustName '$(Deployment.DomainFQDN)' -adminUserName '$(Deployment.DomainName)\$(Deployment.AdminUserName)' -adminPassword '$(Deployment.AdminPassword)'" + preferredAzurePowerShellVersion: 5.1.1 \ No newline at end of file diff --git a/DevOps-Compile.yml b/azure-pipelines/ci-compile.yml similarity index 95% rename from DevOps-Compile.yml rename to azure-pipelines/ci-compile.yml index 5255f36..9b5ffd9 100644 --- a/DevOps-Compile.yml +++ b/azure-pipelines/ci-compile.yml @@ -12,10 +12,8 @@ jobs: matrix: debugJob: configuration: debug - platform: $(BuildPlatform) releaseJob: configuration: release - platform: $(BuildPlatform) displayName: Compile pool: vmImage: 'windows-2019' @@ -65,13 +63,13 @@ jobs: - task: automagically.DownloadFile.DownloadFile.DownloadFile@1 displayName: 'Download ConfigureLab.ps1' inputs: - FileUrl: 'https://raw.githubusercontent.com/Yvand/AzureRM-Templates/dev/DevTestLabs-Artifacts/manage-artifacts/ConfigureLab.ps1' + FileUrl: 'https://raw.githubusercontent.com/Yvand/AzureRM-Templates/master/DevTestLabs-Artifacts/manage-artifacts/ConfigureLab.ps1' DestinationFolder: '$(Build.ArtifactStagingDirectory)\$(Deployment.ConfigureServerFolderName)' - task: automagically.DownloadFile.DownloadFile.DownloadFile@1 displayName: 'Download ConfigureLab.psm1' inputs: - FileUrl: 'https://raw.githubusercontent.com/Yvand/AzureRM-Templates/dev/DevTestLabs-Artifacts/manage-artifacts/ConfigureLab.psm1' + FileUrl: 'https://raw.githubusercontent.com/Yvand/AzureRM-Templates/master/DevTestLabs-Artifacts/manage-artifacts/ConfigureLab.psm1' DestinationFolder: '$(Build.ArtifactStagingDirectory)\$(Deployment.ConfigureServerFolderName)' - task: NuGetToolInstaller@0 diff --git a/DevOps-CreateDTLEnvironment.yml b/azure-pipelines/ci-create-dtl-environment.yml similarity index 58% rename from DevOps-CreateDTLEnvironment.yml rename to azure-pipelines/ci-create-dtl-environment.yml index 7f7440a..658ef1e 100644 --- a/DevOps-CreateDTLEnvironment.yml +++ b/azure-pipelines/ci-create-dtl-environment.yml @@ -6,18 +6,16 @@ jobs: displayName: Create test environment timeoutInMinutes: 90 pool: - vmImage: 'windows-2019' + vmImage: 'windows-latest' steps: - checkout: none #skip checking out the default repository resource - - task: ms-azuredevtestlabs.tasks.azure-dtl-task-createEnvironment.AzureDevTestLabsCreateEnvironment@1 + - task: ms-azuredevtestlabs.tasks.azure-dtl-task-createEnvironment.AzureDevTestLabsCreateEnvironment@3 displayName: 'Create Azure DevTest Labs Environment' inputs: - ConnectedServiceName: '$(DevTestLabs.AzureConnectionName)' + azureSubscription: '$(DevTestLabs.AzureConnectionName)' LabId: '/subscriptions/$(DevTestLabs.AzureSubscriptionId)/resourceGroups/$(DevTestLabs.LabName)/providers/Microsoft.DevTestLab/labs/$(DevTestLabs.LabName)' RepositoryId: '/subscriptions/$(DevTestLabs.AzureSubscriptionId)/resourcegroups/$(DevTestLabs.LabName)/providers/microsoft.devtestlab/labs/$(DevTestLabs.LabName)/artifactsources/$(DevTestLabs.RepoID)' TemplateId: '/subscriptions/$(DevTestLabs.AzureSubscriptionId)/resourceGroups/$(DevTestLabs.LabName)/providers/Microsoft.DevTestLab/labs/$(DevTestLabs.LabName)/artifactSources/$(DevTestLabs.RepoID)/armTemplates/$(DevTestLabs.ARMTemplateName)' EnvironmentName: 'Tests-$(system.teamProject)' - ParameterOverrides: "-provisionSharePoint2013 '$(Deployment.ProvisionSharePoint2013)' -provisionSharePoint2016 '$(Deployment.ProvisionSharePoint2016)' -provisionSharePoint2019 '$(Deployment.ProvisionSharePoint2019)' -enableHybridBenefitServerLicenses 'Yes' -adminUserName '$(Deployment.AdminUserName)' -adminPassword '$(Deployment.AdminPassword)' -serviceAccountsPassword '$(Deployment.ServiceAccountsPassword)' -createPublicIPAndDNS '$(Deployment.CreatePublicIPAndDNS)'" - TemplateOutputVariables: true - ExportEnvironmentTemplate: true + ParameterOverrides: "-provisionSharePoint2013 $(Deployment.ProvisionSharePoint2013) -provisionSharePoint2016 $(Deployment.ProvisionSharePoint2016) -provisionSharePoint2019 $(Deployment.ProvisionSharePoint2019) -provisionSharePointSubscription $(Deployment.ProvisionSharePointSubscription) -adminUserName '$(Deployment.AdminUserName)' -adminPassword '$(Deployment.AdminPassword)' -serviceAccountsPassword '$(Deployment.ServiceAccountsPassword)' -addPublicIPAddressToEachVM true -configureADFS true -addAzureBastion true -enableHybridBenefitServerLicenses true -enableAutomaticUpdates false" timeoutInMinutes: 90 diff --git a/azure-pipelines/ci-run-integration-tests.yml b/azure-pipelines/ci-run-integration-tests.yml new file mode 100644 index 0000000..39b5f1a --- /dev/null +++ b/azure-pipelines/ci-run-integration-tests.yml @@ -0,0 +1,56 @@ +resources: +- repo: self + +jobs: +- job: RunTests + strategy: + maxParallel: 4 + matrix: + OnSharePoint2013: + deployThisSharePointVersion: variables['Deployment.ProvisionSharePoint2013'] + sharePointVersion: 2013 + OnSharePoint2016: + deployThisSharePointVersion: variables['Deployment.ProvisionSharePoint2016'] + sharePointVersion: 2016 + OnSharePoint2019: + deployThisSharePointVersion: variables['Deployment.ProvisionSharePoint2019'] + sharePointVersion: 2019 + OnSharePointSubscription: + deployThisSharePointVersion: variables['Deployment.ProvisionSharePointSubscription'] + sharePointVersion: Subscription + displayName: Run integration tests + #condition: eq(variables['deployThisSharePointVersion'], 'yes') # Not working: variables['deployThisSharePointVersion'] is evaluated to Null + timeoutInMinutes: 30 + pool: + name: $(System.TeamProject)-Tests-$(sharePointVersion) + steps: + - checkout: none #skip checking out the default repository resource + - task: DownloadBuildArtifacts@0 + displayName: 'Download Build Artifacts' + inputs: + buildType: specific + project: '$(System.TeamProjectId)' + pipeline: $(DevOps.BuildArtifactsPipelineID) + specificBuildWithTriggering: true + artifactName: 'drop_$(Tests.BuildConfiguration)' + downloadPath: $(Build.ArtifactStagingDirectory) + itemPattern: | + drop_$(Tests.BuildConfiguration)/$(System.TeamProject)/bin/Release/$(System.TeamProject).pdb + drop_$(Tests.BuildConfiguration)/$(System.TeamProject).Tests/bin/Release/*.dll + drop_$(Tests.BuildConfiguration)/$(Tests.DataFolderName)/?(*.csv|*.json|*.runsettings) + + - task: VisualStudioTestPlatformInstaller@1 + displayName: 'Visual Studio Test Platform Installer' + + - task: VSTest@2 + displayName: 'Run Visual Studio tests' + inputs: + searchFolder: '$(Build.ArtifactStagingDirectory)/drop_$(Tests.BuildConfiguration)/$(System.TeamProject).Tests/bin/Release' + vsTestVersion: toolsInstaller + runSettingsFile: '$(Build.ArtifactStagingDirectory)/drop_$(Tests.BuildConfiguration)/$(Tests.DataFolderName)/DTLServer.runsettings' + overrideTestrunParameters: '$(Tests.OverrideTestrunParameters)' + codeCoverageEnabled: $(Tests.CodeCoverageEnabled) + otherConsoleOptions: '/Platform:x64' + testRunTitle: '$(System.TeamProject)-Tests-SP$(sharePointVersion)' + platform: '$(BuildPlatform)' + configuration: $(Tests.BuildConfiguration)
@@ -184,9 +184,9 @@ - + - +
@@ -247,7 +247,7 @@ - +

@@ -301,7 +301,7 @@
- +