private static async Task TestPoolCreateAndUpdateWithCertificateReferencesAsync( BatchClient batchCli, IList <CertificateReference> certificateReferences) { PoolOperations poolOperations = batchCli.PoolOperations; string poolId = "CreateAndUpdateWithCertificateReferences-" + TestUtilities.GetMyName(); try { // create a pool with initial cert refs CloudPool boundPool; { CloudPool unboundPool = poolOperations.CreatePool( poolId: poolId, virtualMachineSize: PoolFixture.VMSize, cloudServiceConfiguration: new CloudServiceConfiguration(PoolFixture.OSFamily), targetDedicatedComputeNodes: 0); // create the pool with initial cert refs unboundPool.CertificateReferences = certificateReferences; await unboundPool.CommitAsync().ConfigureAwait(false); boundPool = await poolOperations.GetPoolAsync(poolId).ConfigureAwait(false); // confirm the refs are there Assert.NotNull(boundPool.CertificateReferences); AssertCertificateReferenceCollectionsAreSame(certificateReferences, boundPool.CertificateReferences); } // mutate the cert refs: assign only one { List <CertificateReference> listOfOne = new List <CertificateReference>(); // just pick one cert listOfOne.Add(certificateReferences.ToArray()[1]); boundPool.CertificateReferences = listOfOne; await boundPool.CommitAsync().ConfigureAwait(false); await boundPool.RefreshAsync().ConfigureAwait(false); // confirm that the ref collection is correct AssertCertificateReferenceCollectionsAreSame(listOfOne, boundPool.CertificateReferences); } // mutate the pool cert refs: assign null to clear { boundPool.CertificateReferences = null; await boundPool.CommitAsync().ConfigureAwait(false); await boundPool.RefreshAsync().ConfigureAwait(false); Assert.Empty(boundPool.CertificateReferences); } } finally { // cleanup TestUtilities.DeletePoolIfExistsAsync(batchCli, poolId).Wait(); } }