public InternalMinimal( IComputeManager computeManager, [CallerMemberName] string methodName = "testframework_failed") : base(methodName) { loadBalancerHelper = new LoadBalancerHelper(TestUtilities.GenerateName(methodName)); this.computeManager = computeManager; }
private Azure(RestClient restClient, string subscriptionId, string tenantId, IAuthenticated authenticated) { resourceManager = ResourceManager.Fluent.ResourceManager.Authenticate(restClient).WithSubscription(subscriptionId); storageManager = StorageManager.Authenticate(restClient, subscriptionId); computeManager = ComputeManager.Authenticate(restClient, subscriptionId); networkManager = NetworkManager.Authenticate(restClient, subscriptionId); batchManager = BatchManager.Authenticate(restClient, subscriptionId); keyVaultManager = KeyVaultManager.Authenticate(restClient, subscriptionId, tenantId); trafficManager = TrafficManager.Fluent.TrafficManager.Authenticate(restClient, subscriptionId); dnsZoneManager = DnsZoneManager.Authenticate(restClient, subscriptionId); sqlManager = SqlManager.Authenticate(restClient, subscriptionId); redisManager = RedisManager.Authenticate(restClient, subscriptionId); cdnManager = CdnManager.Authenticate(restClient, subscriptionId); appServiceManager = AppServiceManager.Authenticate(restClient, subscriptionId, tenantId); searchManager = SearchManager.Authenticate(restClient, subscriptionId); serviceBusManager = ServiceBusManager.Authenticate(restClient, subscriptionId); containerInstanceManager = ContainerInstanceManager.Authenticate(restClient, subscriptionId); registryManager = RegistryManager.Authenticate(restClient, subscriptionId); containerServiceManager = ContainerServiceManager.Authenticate(restClient, subscriptionId); cosmosDBManager = CosmosDBManager.Authenticate(restClient, subscriptionId); authorizationManager = AuthorizationManager.Authenticate(restClient, subscriptionId); msiManager = MsiManager.Authenticate(restClient, subscriptionId); batchAIManager = BatchAIManager.Authenticate(restClient, subscriptionId); monitorManager = MonitorManager.Authenticate(restClient, subscriptionId); eventHubManager = EventHubManager.Authenticate(restClient, subscriptionId); SubscriptionId = subscriptionId; this.authenticated = authenticated; }
///GENMHASH:7085203F0E54D9143441675F515A5350:8187A0188F5A617E219748998105A41C internal GalleryImageImpl(GalleryImageInner inner, IComputeManager computeManager) : base(inner.Name, inner) { this.computeManager = computeManager; // Set resource name this.galleryImageName = inner.Name; // resource ancestor names this.resourceGroupName = GetValueFromIdByName(inner.Id, "resourceGroups"); this.galleryName = GetValueFromIdByName(inner.Id, "galleries"); this.galleryImageName = GetValueFromIdByName(inner.Id, "images"); }
///GENMHASH:142BF410A4E871AE35AD3B4F42DEEEED:297C906CC91021F0511221843025550B internal GalleryImageVersionImpl(GalleryImageVersionInner inner, IComputeManager manager) : base(inner.Name, inner) { this.computeManager = manager; // Set resource name this.galleryImageVersionName = inner.Name; // resource ancestor names this.resourceGroupName = ResourceUtils.GetValueFromIdByName(inner.Id, "resourceGroups"); this.galleryName = ResourceUtils.GetValueFromIdByName(inner.Id, "galleries"); this.galleryImageName = ResourceUtils.GetValueFromIdByName(inner.Id, "images"); this.galleryImageVersionName = ResourceUtils.GetValueFromIdByName(inner.Id, "versions"); }
public void CanCRUDAvailabilitySet() { using (var context = FluentMockContext.Start(GetType().FullName)) { var rgName = TestUtilities.GenerateName("rgstg"); var availName = TestUtilities.GenerateName("availset"); try { // Create IComputeManager computeManager = TestHelper.CreateComputeManager(); var availabilitySet = computeManager.AvailabilitySets .Define(availName) .WithRegion(Region.USEast) .WithNewResourceGroup(rgName) .WithUpdateDomainCount(2) .WithFaultDomainCount(3) .Create(); Assert.Equal(availabilitySet.ResourceGroupName, rgName); Assert.True(availabilitySet.UpdateDomainCount == 2); Assert.True(availabilitySet.FaultDomainCount == 3); // Get var feteched = computeManager.AvailabilitySets.GetById(availabilitySet.Id); Assert.NotNull(feteched); // List var availabilitySets = computeManager.AvailabilitySets.ListByResourceGroup(rgName); // todo: fix listing // Assert.True(availabilitySets.Count() > 0); // Update var availabilitySetUpdated = availabilitySet.Update() .WithTag("a", "aa") .WithTag("b", "bb") .Apply(); // Delete computeManager.AvailabilitySets.DeleteById(availabilitySet.Id); } finally { try { var resourceManager = TestHelper.CreateResourceManager(); resourceManager.ResourceGroups.DeleteByName(rgName); } catch { } } } }
public Kernels(IComputeManager computeManager) { _disposable.Add(computeManager); const string options = "-cl-std=CL1.2"; computeManager.AddProgram(KernelSources.threshold, options); computeManager.AddProgram(KernelSources.grayscale, options); computeManager.AddProgram(KernelSources.sobel, options); computeManager.AddProgram(KernelSources.canny, options); computeManager.AddProgram(KernelSources.non_maximum_supression, options); computeManager.AddProgram(KernelSources.gauss_blur, options); _computeManager = computeManager; }
// Ensure VMs for the LB public IEnumerable <IVirtualMachine> EnsureVMs( INetworks networks, IComputeManager computeManager, int count) { // Create a network for the VMs INetwork network = networks.Define("net" + TestId) .WithRegion(Region) .WithNewResourceGroup(GroupName) .WithAddressSpace("10.0.0.0/28") .WithSubnet("subnet1", "10.0.0.0/29") .WithSubnet("subnet2", "10.0.0.8/29") .Create(); // Define an availability set for the VMs var availabilitySetDefinition = computeManager.AvailabilitySets.Define("as" + TestId) .WithRegion(Region) .WithExistingResourceGroup(GroupName) .WithSku(AvailabilitySetSkuTypes.Managed); // Create the requested number of VM definitions string userName = "******" + TestId; List <ICreatable <IVirtualMachine> > vmDefinitions = new List <ICreatable <IVirtualMachine> >(); for (int i = 0; i < count; i++) { string vmName = TestUtilities.GenerateName("vm"); var vm = computeManager.VirtualMachines.Define(vmName) .WithRegion(Region) .WithExistingResourceGroup(GroupName) .WithExistingPrimaryNetwork(network) .WithSubnet(network.Subnets.Values.First().Name) .WithPrimaryPrivateIPAddressDynamic() .WithoutPrimaryPublicIPAddress() .WithPopularLinuxImage(KnownLinuxVirtualMachineImage.UbuntuServer14_04_Lts) .WithRootUsername(userName) .WithRootPassword("Abcdef.123456") .WithNewAvailabilitySet(availabilitySetDefinition) .WithSize(VirtualMachineSizeTypes.StandardA1); vmDefinitions.Add(vm); } var createdVMs = computeManager.VirtualMachines.Create(vmDefinitions.ToArray()); return(createdVMs); }
private IVirtualMachine PrepareGeneralizedVMWith2EmptyDataDisks(string rgName, string vmName, Region Location, IComputeManager computeManager) { var uname = "javauser"; var password = "******"; KnownLinuxVirtualMachineImage linuxImage = KnownLinuxVirtualMachineImage.UbuntuServer16_04_Lts; var publicIPDnsLabel = SdkContext.RandomResourceName("pip", 20); var virtualMachine = computeManager.VirtualMachines .Define(vmName) .WithRegion(Location) .WithNewResourceGroup(rgName) .WithNewPrimaryNetwork("10.0.0.0/28") .WithPrimaryPrivateIPAddressDynamic() .WithNewPrimaryPublicIPAddress(publicIPDnsLabel) .WithPopularLinuxImage(linuxImage) .WithRootUsername(uname) .WithRootPassword(password) .WithUnmanagedDisks() .DefineUnmanagedDataDisk("disk-1") .WithNewVhd(30) .WithCaching(CachingTypes.ReadWrite) .Attach() .DefineUnmanagedDataDisk("disk-2") .WithNewVhd(60) .WithCaching(CachingTypes.ReadOnly) .Attach() .WithSize(VirtualMachineSizeTypes.StandardD5V2) .WithNewStorageAccount(SdkContext.RandomResourceName("stg", 17)) .WithOSDiskCaching(CachingTypes.ReadWrite) .Create(); // TestHelper.DeprovisionAgentInLinuxVM(virtualMachine.GetPrimaryPublicIPAddress().Fqdn, 22, uname, password); virtualMachine.Deallocate(); virtualMachine.Generalize(); return(virtualMachine); }
public void CanEncryptVirtualMachine() { using (var context = FluentMockContext.Start(GetType().FullName)) { var rgName = TestUtilities.GenerateName("rgstg"); try { // https://docs.microsoft.com/en-us/azure/security/azure-security-disk-encryption // // KeyVault Resource ID string keyVaultId = "KEY_VAULT_ID_HERE"; // Azure AD service principal client (application) ID string aadClientId = "AAD_APPLICATION_ID_HERE"; // Azure AD service principal client secret string aadSecret = "AAD_CLIENT_SECRET_HERE"; // Create IComputeManager computeManager = TestHelper.CreateComputeManager(); var publicIpDnsLabel = TestUtilities.GenerateName("pip"); var vmName1 = "myvm1"; var uname = "juser"; var password = "******"; var virtualMachine = computeManager.VirtualMachines .Define(vmName1) .WithRegion(Region.USEast2) .WithNewResourceGroup(rgName) .WithNewPrimaryNetwork("10.0.0.0/28") .WithPrimaryPrivateIPAddressDynamic() .WithNewPrimaryPublicIPAddress(publicIpDnsLabel) .WithLatestLinuxImage("RedHat", "RHEL", "7.2") .WithRootUsername(uname) .WithRootPassword(password) .WithSize(VirtualMachineSizeTypes.StandardD5V2) .WithOSDiskCaching(CachingTypes.ReadWrite) .Create(); // Check inital encryption status // var monitor = virtualMachine.DiskEncryption.GetMonitor(); Assert.NotNull(monitor); Assert.NotNull(monitor.OSDiskStatus); Assert.NotNull(monitor.DataDiskStatus); Assert.True(monitor.OSDiskStatus.Equals(EncryptionStatus.NotEncrypted)); Assert.True(monitor.DataDiskStatus.Equals(EncryptionStatus.NotEncrypted)); // Check monitor refresh // var monitor1 = monitor.Refresh(); Assert.NotNull(monitor1); Assert.NotNull(monitor1.OSDiskStatus); Assert.NotNull(monitor1.DataDiskStatus); Assert.True(monitor.OSDiskStatus.Equals(EncryptionStatus.NotEncrypted)); Assert.True(monitor.DataDiskStatus.Equals(EncryptionStatus.NotEncrypted)); var monitor2 = virtualMachine .DiskEncryption .Enable(keyVaultId, aadClientId, aadSecret); Assert.NotNull(monitor2); Assert.NotNull(monitor2.OSDiskStatus); Assert.NotNull(monitor2.DataDiskStatus); monitor1.Refresh(); Assert.True(monitor1.OSDiskStatus.Equals(monitor2.OSDiskStatus)); Assert.True(monitor1.DataDiskStatus.Equals(monitor2.DataDiskStatus)); monitor2.Refresh(); Assert.True(monitor2.OSDiskStatus.Equals(EncryptionStatus.EncryptionInProgress)); TestHelper.WriteLine(virtualMachine.Id); } finally { try { var resourceManager = TestHelper.CreateResourceManager(); resourceManager.ResourceGroups.DeleteByName(rgName); } catch { } } } }
///GENMHASH:4C297816DBAE1263D05C994CFC8D1928:C5C9A7A1846EEA08D381D40B63B43DC6 internal GalleryImpl(string name, GalleryInner innerModel, IComputeManager computeManager) : base(name, innerModel, computeManager) { }
///GENMHASH:2F547EF235083E7C24F2AAD75FCE9FFC:C140D4869BF21B82D034CCD0BC161B59 internal VirtualMachineScaleSetVMsImpl(VirtualMachineScaleSetImpl scaleSet, IComputeManager computeManager) { this.scaleSet = scaleSet; Manager = computeManager; }
/// <summary> /// Creates LinuxDiskVolumeLegacyEncryptionMonitorImpl. /// </summary> /// <param name="virtualMachineId">Resource id of Linux virtual machine to retrieve encryption status from.</param> /// <param name="computeManager">Compute manager.</param> ///GENMHASH:A42CB27228CC0FEEF184DFCCC4F8DCB2:0C2BFB2332C823A9307222D73EFBAF83 internal LinuxDiskVolumeLegacyEncryptionMonitorImpl(string virtualMachineId, IComputeManager computeManager) { this.rgName = ResourceUtils.GroupFromResourceId(virtualMachineId); this.vmName = ResourceUtils.NameFromResourceId(virtualMachineId); this.computeManager = computeManager; }
///GENMHASH:27AE3C88D6A0823E2356C59DA4236D18:666F587DB54BEB717C40C0642603C57C internal GalleryImageImpl(string name, IComputeManager computeManager) : base(name, new GalleryImageInner()) { this.computeManager = computeManager; // Set resource name this.galleryImageName = name; }
// Helper method to pre-create infrastructure to test Network Watcher ICreatedResources <IVirtualMachine> EnsureNetwork(INetworkManager networkManager, IComputeManager computeManager, String groupName) { IVirtualMachines vms = computeManager.VirtualMachines; // Create an NSG INetworkSecurityGroup nsg = networkManager.NetworkSecurityGroups.Define(SdkContext.RandomResourceName("nsg", 8)) .WithRegion(REGION) .WithNewResourceGroup(groupName) .Create(); // Create a network for the VMs INetwork network = networkManager.Networks.Define(SdkContext.RandomResourceName("net", 8)) .WithRegion(REGION) .WithExistingResourceGroup(groupName) .WithAddressSpace("10.0.0.0/28") .DefineSubnet("subnet1") .WithAddressPrefix("10.0.0.0/29") .WithExistingNetworkSecurityGroup(nsg) .Attach() .WithSubnet("subnet2", "10.0.0.8/29") .Create(); INetworkInterface nic = networkManager.NetworkInterfaces.Define(SdkContext.RandomResourceName("ni", 8)) .WithRegion(REGION) .WithExistingResourceGroup(groupName) .WithNewPrimaryNetwork("10.0.0.0/28") .WithPrimaryPrivateIPAddressDynamic() .WithNewPrimaryPublicIPAddress(SdkContext.RandomResourceName("pip", 8)) .WithIPForwarding() .WithExistingNetworkSecurityGroup(nsg) .Create(); // Create the requested number of VM definitions String userName = "******"; var vmDefinitions = new List <ICreatable <IVirtualMachine> >(); var vm1 = vms.Define(SdkContext.RandomResourceName("vm", 15)) .WithRegion(REGION) .WithExistingResourceGroup(groupName) .WithExistingPrimaryNetworkInterface(nic) .WithPopularLinuxImage(KnownLinuxVirtualMachineImage.UbuntuServer14_04_Lts) .WithRootUsername(userName) .WithRootPassword("Abcdef.123456") .WithSize(VirtualMachineSizeTypes.StandardA1) .DefineNewExtension("packetCapture") .WithPublisher("Microsoft.Azure.NetworkWatcher") .WithType("NetworkWatcherAgentLinux") .WithVersion("1.4") .WithMinorVersionAutoUpgrade() .Attach(); String vmName = SdkContext.RandomResourceName("vm", 15); ICreatable <IVirtualMachine> vm2 = vms.Define(vmName) .WithRegion(REGION) .WithExistingResourceGroup(groupName) .WithExistingPrimaryNetwork(network) .WithSubnet(network.Subnets.Values.First().Name) .WithPrimaryPrivateIPAddressDynamic() .WithoutPrimaryPublicIPAddress() .WithPopularLinuxImage(KnownLinuxVirtualMachineImage.UbuntuServer14_04_Lts) .WithRootUsername(userName) .WithRootPassword("Abcdef.123456") .WithSize(VirtualMachineSizeTypes.StandardA1); vmDefinitions.Add(vm1); vmDefinitions.Add(vm2); vms.Create(vmDefinitions); var createdVMs2 = vms.Create(vmDefinitions); return(createdVMs2); }
public void Initialize(IComputeManager myManager) { this.ComputeManager = myManager; }
public TextDetector(IComputeManager computeManager) { _computeManager = computeManager; }
///GENMHASH:3A1EEE0D46163B2BB169EDD0192927A1:96ECD0088A4ADA604D8B34B2EB91EAA4 internal GalleryImagesImpl(IComputeManager computeManager) : base(computeManager.Inner.GalleryImages) { this.computeManager = computeManager; }
///GENMHASH:C5378B9EF2CBEA67609922A619C2EE9C:D736A936D9D3AF7AC6642FBDEA5B2EE8 internal GalleryImageVersionImpl(string name, IComputeManager manager) : base(name, new GalleryImageVersionInner()) { this.computeManager = manager; // Set resource name this.galleryImageVersionName = name; }
///GENMHASH:AD27D3B464C617FF7BD739B06405A654:0A321A6C5FAF43B9081469690636C762 internal ComputeSkusImpl(IComputeManager computeManager) { this.manager = computeManager; }
public void CanCRUDLocks() { using (var context = FluentMockContext.Start(GetType().FullName)) { IAuthorizationManager authorizationManager = TestHelper.CreateAuthorizationManager(); IComputeManager computeManager = TestHelper.CreateComputeManager(); IResourceManager managerResources = computeManager.ResourceManager; INetworkManager networkManager = TestHelper.CreateNetworkManager(); IStorageManager storageManager = TestHelper.CreateStorageManager(); // Prepare a VM string password = SdkContext.RandomResourceName("P@s", 14); string rgName = SdkContext.RandomResourceName("rg", 15); string vmName = SdkContext.RandomResourceName("vm", 15); string storageName = SdkContext.RandomResourceName("st", 15); string diskName = SdkContext.RandomResourceName("dsk", 15); string netName = SdkContext.RandomResourceName("net", 15); Region region = Region.USEast; IResourceGroup resourceGroup = null; IManagementLock lockGroup = null, lockVM = null, lockStorage = null, lockDiskRO = null, lockDiskDel = null, lockSubnet = null; try { resourceGroup = managerResources.ResourceGroups.Define(rgName) .WithRegion(region) .Create(); Assert.NotNull(resourceGroup); ICreatable <INetwork> netDefinition = networkManager.Networks.Define(netName) .WithRegion(region) .WithExistingResourceGroup(resourceGroup) .WithAddressSpace("10.0.0.0/28"); // Define a VM for testing VM locks ICreatable <IVirtualMachine> vmDefinition = computeManager.VirtualMachines.Define(vmName) .WithRegion(region) .WithExistingResourceGroup(resourceGroup) .WithNewPrimaryNetwork(netDefinition) .WithPrimaryPrivateIPAddressDynamic() .WithoutPrimaryPublicIPAddress() .WithPopularWindowsImage(KnownWindowsVirtualMachineImage.WindowsServer2012R2Datacenter) .WithAdminUsername("tester") .WithAdminPassword(password) .WithSize(VirtualMachineSizeTypes.BasicA1); // Define a managed disk for testing locks on that ICreatable <IDisk> diskDefinition = computeManager.Disks.Define(diskName) .WithRegion(region) .WithExistingResourceGroup(resourceGroup) .WithData() .WithSizeInGB(100); // Define a storage account for testing locks on that ICreatable <IStorageAccount> storageDefinition = storageManager.StorageAccounts.Define(storageName) .WithRegion(region) .WithExistingResourceGroup(resourceGroup); // Create resources in parallel to save time and money Extensions.Synchronize(() => Task.WhenAll( storageDefinition.CreateAsync(), vmDefinition.CreateAsync(), diskDefinition.CreateAsync())); IVirtualMachine vm = (IVirtualMachine)vmDefinition; IStorageAccount storage = (IStorageAccount)storageDefinition; IDisk disk = (IDisk)diskDefinition; INetwork network = vm.GetPrimaryNetworkInterface().PrimaryIPConfiguration.GetNetwork(); ISubnet subnet = network.Subnets.Values.FirstOrDefault(); // Lock subnet ICreatable <IManagementLock> lockSubnetDef = authorizationManager.ManagementLocks.Define("subnetLock") .WithLockedResource(subnet.Inner.Id) .WithLevel(LockLevel.ReadOnly); // Lock VM ICreatable <IManagementLock> lockVMDef = authorizationManager.ManagementLocks.Define("vmlock") .WithLockedResource(vm) .WithLevel(LockLevel.ReadOnly) .WithNotes("vm readonly lock"); // Lock resource group ICreatable <IManagementLock> lockGroupDef = authorizationManager.ManagementLocks.Define("rglock") .WithLockedResource(resourceGroup.Id) .WithLevel(LockLevel.CanNotDelete); // Lock storage ICreatable <IManagementLock> lockStorageDef = authorizationManager.ManagementLocks.Define("stLock") .WithLockedResource(storage) .WithLevel(LockLevel.CanNotDelete); // Create locks in parallel ICreatedResources <IManagementLock> created = authorizationManager.ManagementLocks.Create(lockVMDef, lockGroupDef, lockStorageDef, lockSubnetDef); lockVM = created.FirstOrDefault(o => o.Key.Equals(lockVMDef.Key)); lockStorage = created.FirstOrDefault(o => o.Key.Equals(lockStorageDef.Key)); lockGroup = created.FirstOrDefault(o => o.Key.Equals(lockGroupDef.Key)); lockSubnet = created.FirstOrDefault(o => o.Key.Equals(lockSubnetDef.Key)); // Lock disk synchronously lockDiskRO = authorizationManager.ManagementLocks.Define("diskLockRO") .WithLockedResource(disk) .WithLevel(LockLevel.ReadOnly) .Create(); lockDiskDel = authorizationManager.ManagementLocks.Define("diskLockDel") .WithLockedResource(disk) .WithLevel(LockLevel.CanNotDelete) .Create(); // Verify VM lock Assert.Equal(2, authorizationManager.ManagementLocks.ListForResource(vm.Id).Count()); Assert.NotNull(lockVM); lockVM = authorizationManager.ManagementLocks.GetById(lockVM.Id); Assert.NotNull(lockVM); Assert.Equal(LockLevel.ReadOnly, lockVM.Level); Assert.Equal(vm.Id, lockVM.LockedResourceId, true); // Verify resource group lock Assert.NotNull(lockGroup); lockGroup = authorizationManager.ManagementLocks.GetByResourceGroup(resourceGroup.Name, "rglock"); Assert.NotNull(lockGroup); Assert.Equal(LockLevel.CanNotDelete, lockGroup.Level); Assert.Equal(resourceGroup.Id, lockGroup.LockedResourceId, true); // Verify storage account lock Assert.Equal(2, authorizationManager.ManagementLocks.ListForResource(storage.Id).Count()); Assert.NotNull(lockStorage); lockStorage = authorizationManager.ManagementLocks.GetById(lockStorage.Id); Assert.NotNull(lockStorage); Assert.Equal(LockLevel.CanNotDelete, lockStorage.Level); Assert.Equal(storage.Id, lockStorage.LockedResourceId, true); // Verify disk lock Assert.Equal(3, authorizationManager.ManagementLocks.ListForResource(disk.Id).Count()); Assert.NotNull(lockDiskRO); lockDiskRO = authorizationManager.ManagementLocks.GetById(lockDiskRO.Id); Assert.NotNull(lockDiskRO); Assert.Equal(LockLevel.ReadOnly, lockDiskRO.Level); Assert.Equal(disk.Id, lockDiskRO.LockedResourceId, true); Assert.NotNull(lockDiskDel); lockDiskDel = authorizationManager.ManagementLocks.GetById(lockDiskDel.Id); Assert.NotNull(lockDiskDel); Assert.Equal(LockLevel.CanNotDelete, lockDiskDel.Level); Assert.Equal(disk.Id, lockDiskDel.LockedResourceId, true); // Verify subnet lock Assert.Equal(2, authorizationManager.ManagementLocks.ListForResource(network.Id).Count()); lockSubnet = authorizationManager.ManagementLocks.GetById(lockSubnet.Id); Assert.NotNull(lockSubnet); Assert.Equal(LockLevel.ReadOnly, lockSubnet.Level); Assert.Equal(subnet.Inner.Id, lockSubnet.LockedResourceId, true); // Verify lock collection var locksSubscription = authorizationManager.ManagementLocks.List(); var locksGroup = authorizationManager.ManagementLocks.ListByResourceGroup(vm.ResourceGroupName); Assert.NotNull(locksSubscription); Assert.NotNull(locksGroup); int locksAllCount = locksSubscription.Count(); Assert.True(6 <= locksAllCount); int locksGroupCount = locksGroup.Count(); Assert.Equal(6, locksGroup.Count()); } finally { try { if (resourceGroup != null) { if (lockGroup != null) { authorizationManager.ManagementLocks.DeleteById(lockGroup.Id); } if (lockVM != null) { authorizationManager.ManagementLocks.DeleteById(lockVM.Id); } if (lockDiskRO != null) { authorizationManager.ManagementLocks.DeleteById(lockDiskRO.Id); } if (lockDiskDel != null) { authorizationManager.ManagementLocks.DeleteById(lockDiskDel.Id); } if (lockStorage != null) { authorizationManager.ManagementLocks.DeleteById(lockStorage.Id); } if (lockSubnet != null) { authorizationManager.ManagementLocks.DeleteById(lockSubnet.Id); } managerResources.ResourceGroups.BeginDeleteByName(rgName); } } catch { } } } }
internal WindowsVolumeNoAADEncryptionMonitorImpl(string virtualMachineId, IComputeManager computeManager) { this.rgName = ResourceUtils.GroupFromResourceId(virtualMachineId); this.vmName = ResourceUtils.NameFromResourceId(virtualMachineId); this.computeManager = computeManager; }