public async Task PlacementGroupId() { var asetName = Recording.GenerateAssetName("aset-"); AvailabilitySet aset = await CreateAvailabilitySetAsync(asetName); var beforeAdd = aset.Data.ProximityPlacementGroupId; ResourceGroup rg = Client.GetResourceGroup(ResourceGroup.CreateResourceIdentifier(aset.Id.SubscriptionId, aset.Id.ResourceGroupName)); var proxGrpName = Recording.GenerateAssetName("proxGrp-"); ProximityPlacementGroup proxGrp = (await rg.GetProximityPlacementGroups().CreateOrUpdateAsync(true, proxGrpName, new ProximityPlacementGroupData(DefaultLocation))).Value; AvailabilitySetUpdateOptions updateOptions = new AvailabilitySetUpdateOptions(); updateOptions.ProximityPlacementGroupId = proxGrp.Id; aset = await aset.UpdateAsync(updateOptions); var addIdResult = aset.Data.ProximityPlacementGroupId; updateOptions.ProximityPlacementGroupId = null; aset = await aset.UpdateAsync(updateOptions); var removeIdResult = aset.Data.ProximityPlacementGroupId; var asetName2 = Recording.GenerateAssetName("aset-"); AvailabilitySet aset2 = await CreateAvailabilitySetAsync(asetName2); var newBeforeAdd = aset2.Data.ProximityPlacementGroup?.Id; AvailabilitySetUpdateOptions updateOptions2 = new AvailabilitySetUpdateOptions(); updateOptions2.ProximityPlacementGroup = new Resources.Models.WritableSubResource(); updateOptions2.ProximityPlacementGroup.Id = proxGrp.Id; aset2 = await aset2.UpdateAsync(updateOptions2); var newAddIdResult = aset2.Data.ProximityPlacementGroup.Id; updateOptions2.ProximityPlacementGroup.Id = null; aset2 = await aset2.UpdateAsync(updateOptions2); var newRemoveIdResult = aset2.Data.ProximityPlacementGroup?.Id; updateOptions2.ProximityPlacementGroup.Id = proxGrp.Id; aset2 = await aset2.UpdateAsync(updateOptions2); Assert.NotNull(aset2.Data.ProximityPlacementGroup.Id); updateOptions2.ProximityPlacementGroup = null; aset2 = await aset2.UpdateAsync(updateOptions2); var newRemoveOuterIdResult = aset2.Data.ProximityPlacementGroup?.Id; Assert.AreEqual(beforeAdd, newBeforeAdd); Assert.AreEqual(addIdResult, newAddIdResult); Assert.AreEqual(removeIdResult, newRemoveIdResult); Assert.AreEqual(removeIdResult, newRemoveOuterIdResult); }