Exemple #1
0
        private void Run()
        {
            WriteWarning("Add-AzureRmVmssDataDisk: A property of the output of this cmdlet will change in an upcoming breaking change release. " +
                         "The StorageAccountType property for a DataDisk will return Standard_LRS and Premium_LRS");

            // VirtualMachineProfile
            if (this.VirtualMachineScaleSet.VirtualMachineProfile == null)
            {
                this.VirtualMachineScaleSet.VirtualMachineProfile = new Microsoft.Azure.Management.Compute.Models.VirtualMachineScaleSetVMProfile();
            }

            // StorageProfile
            if (this.VirtualMachineScaleSet.VirtualMachineProfile.StorageProfile == null)
            {
                this.VirtualMachineScaleSet.VirtualMachineProfile.StorageProfile = new Microsoft.Azure.Management.Compute.Models.VirtualMachineScaleSetStorageProfile();
            }

            // DataDisks
            if (this.VirtualMachineScaleSet.VirtualMachineProfile.StorageProfile.DataDisks == null)
            {
                this.VirtualMachineScaleSet.VirtualMachineProfile.StorageProfile.DataDisks = new List <Microsoft.Azure.Management.Compute.Models.VirtualMachineScaleSetDataDisk>();
            }

            var vDataDisks = new Microsoft.Azure.Management.Compute.Models.VirtualMachineScaleSetDataDisk();

            vDataDisks.Name    = this.MyInvocation.BoundParameters.ContainsKey("Name") ? this.Name : null;
            vDataDisks.Lun     = this.Lun;
            vDataDisks.Caching = this.MyInvocation.BoundParameters.ContainsKey("Caching") ? this.Caching : (CachingTypes?)null;
            vDataDisks.WriteAcceleratorEnabled = this.WriteAccelerator.IsPresent;
            vDataDisks.CreateOption            = this.MyInvocation.BoundParameters.ContainsKey("CreateOption") ? this.CreateOption : null;
            vDataDisks.DiskSizeGB = this.MyInvocation.BoundParameters.ContainsKey("DiskSizeGB") ? this.DiskSizeGB : (int?)null;
            if (this.MyInvocation.BoundParameters.ContainsKey("StorageAccountType"))
            {
                WriteWarning("Add-AzureRmVmssDataDisk: The accepted values for parameter StorageAccountType will change in an upcoming breaking change release " +
                             "from StandardLRS and PremiumLRS to Standard_LRS and Premium_LRS, respectively.");
                // ManagedDisk
                vDataDisks.ManagedDisk = new Microsoft.Azure.Management.Compute.Models.VirtualMachineScaleSetManagedDiskParameters();
                vDataDisks.ManagedDisk.StorageAccountType = this.StorageAccountType;
            }
            this.VirtualMachineScaleSet.VirtualMachineProfile.StorageProfile.DataDisks.Add(vDataDisks);
            WriteObject(this.VirtualMachineScaleSet);
        }
Exemple #2
0
        private void Run()
        {
            // VirtualMachineProfile
            if (this.VirtualMachineScaleSet.VirtualMachineProfile == null)
            {
                this.VirtualMachineScaleSet.VirtualMachineProfile = new Microsoft.Azure.Management.Compute.Models.VirtualMachineScaleSetVMProfile();
            }

            // StorageProfile
            if (this.VirtualMachineScaleSet.VirtualMachineProfile.StorageProfile == null)
            {
                this.VirtualMachineScaleSet.VirtualMachineProfile.StorageProfile = new Microsoft.Azure.Management.Compute.Models.VirtualMachineScaleSetStorageProfile();
            }

            // DataDisks
            if (this.VirtualMachineScaleSet.VirtualMachineProfile.StorageProfile.DataDisks == null)
            {
                this.VirtualMachineScaleSet.VirtualMachineProfile.StorageProfile.DataDisks = new List <Microsoft.Azure.Management.Compute.Models.VirtualMachineScaleSetDataDisk>();
            }

            var vDataDisks = new Microsoft.Azure.Management.Compute.Models.VirtualMachineScaleSetDataDisk();

            vDataDisks.Name    = this.Name;
            vDataDisks.Lun     = this.Lun;
            vDataDisks.Caching = this.Caching;
            vDataDisks.WriteAcceleratorEnabled = this.WriteAccelerator.IsPresent;
            if (this.CreateOption.HasValue)
            {
                vDataDisks.CreateOption = this.CreateOption.Value;
            }
            vDataDisks.DiskSizeGB = this.DiskSizeGB;
            if (this.StorageAccountType != null)
            {
                // ManagedDisk
                vDataDisks.ManagedDisk = new Microsoft.Azure.Management.Compute.Models.VirtualMachineScaleSetManagedDiskParameters();
                vDataDisks.ManagedDisk.StorageAccountType = this.StorageAccountType;
            }
            this.VirtualMachineScaleSet.VirtualMachineProfile.StorageProfile.DataDisks.Add(vDataDisks);
            WriteObject(this.VirtualMachineScaleSet);
        }
Exemple #3
0
        private void Run()
        {
            // VirtualMachineProfile
            if (this.VirtualMachineScaleSet.VirtualMachineProfile == null)
            {
                this.VirtualMachineScaleSet.VirtualMachineProfile = new Microsoft.Azure.Management.Compute.Models.VirtualMachineScaleSetVMProfile();
            }

            // StorageProfile
            if (this.VirtualMachineScaleSet.VirtualMachineProfile.StorageProfile == null)
            {
                this.VirtualMachineScaleSet.VirtualMachineProfile.StorageProfile = new Microsoft.Azure.Management.Compute.Models.VirtualMachineScaleSetStorageProfile();
            }

            // DataDisks
            if (this.VirtualMachineScaleSet.VirtualMachineProfile.StorageProfile.DataDisks == null)
            {
                this.VirtualMachineScaleSet.VirtualMachineProfile.StorageProfile.DataDisks = new List <Microsoft.Azure.Management.Compute.Models.VirtualMachineScaleSetDataDisk>();
            }

            var vDataDisks = new Microsoft.Azure.Management.Compute.Models.VirtualMachineScaleSetDataDisk();

            vDataDisks.Name    = this.MyInvocation.BoundParameters.ContainsKey("Name") ? this.Name : null;
            vDataDisks.Lun     = this.Lun;
            vDataDisks.Caching = this.MyInvocation.BoundParameters.ContainsKey("Caching") ? this.Caching : (CachingTypes?)null;
            vDataDisks.WriteAcceleratorEnabled = this.WriteAccelerator.IsPresent;
            vDataDisks.CreateOption            = this.MyInvocation.BoundParameters.ContainsKey("CreateOption") ? this.CreateOption : null;
            vDataDisks.DiskSizeGB = this.MyInvocation.BoundParameters.ContainsKey("DiskSizeGB") ? this.DiskSizeGB : (int?)null;
            if (this.MyInvocation.BoundParameters.ContainsKey("StorageAccountType"))
            {
                // ManagedDisk
                vDataDisks.ManagedDisk = new Microsoft.Azure.Management.Compute.Models.VirtualMachineScaleSetManagedDiskParameters();
                vDataDisks.ManagedDisk.StorageAccountType = this.StorageAccountType;
            }
            this.VirtualMachineScaleSet.VirtualMachineProfile.StorageProfile.DataDisks.Add(vDataDisks);
            WriteObject(this.VirtualMachineScaleSet);
        }