Exemple #1
0
        private void Run()
        {
            // VirtualMachineProfile
            if (this.VirtualMachineScaleSet.VirtualMachineProfile == null)
            {
                this.VirtualMachineScaleSet.VirtualMachineProfile = new Microsoft.Azure.Management.Compute.Models.VirtualMachineScaleSetVMProfile();
            }

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

            // Secrets
            if (this.VirtualMachineScaleSet.VirtualMachineProfile.OsProfile.Secrets == null)
            {
                this.VirtualMachineScaleSet.VirtualMachineProfile.OsProfile.Secrets = new List <Microsoft.Azure.Management.Compute.Models.VaultSecretGroup>();
            }

            var vSecrets = new Microsoft.Azure.Management.Compute.Models.VaultSecretGroup();

            if (this.MyInvocation.BoundParameters.ContainsKey("SourceVaultId"))
            {
                // SourceVault
                vSecrets.SourceVault    = new Microsoft.Azure.Management.Compute.Models.SubResource();
                vSecrets.SourceVault.Id = this.SourceVaultId;
            }
            vSecrets.VaultCertificates = this.MyInvocation.BoundParameters.ContainsKey("VaultCertificate") ? this.VaultCertificate : null;
            this.VirtualMachineScaleSet.VirtualMachineProfile.OsProfile.Secrets.Add(vSecrets);
            WriteObject(this.VirtualMachineScaleSet);
        }
        private void Run()
        {
            // VirtualMachineProfile
            if (this.VirtualMachineScaleSet.VirtualMachineProfile == null)
            {
                this.VirtualMachineScaleSet.VirtualMachineProfile = new Microsoft.Azure.Management.Compute.Models.VirtualMachineScaleSetVMProfile();
            }

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

            // Secrets
            if (this.VirtualMachineScaleSet.VirtualMachineProfile.OsProfile.Secrets == null)
            {
                this.VirtualMachineScaleSet.VirtualMachineProfile.OsProfile.Secrets = new List <Microsoft.Azure.Management.Compute.Models.VaultSecretGroup>();
            }

            var vSecrets = new Microsoft.Azure.Management.Compute.Models.VaultSecretGroup();

            if (this.SourceVaultId != null)
            {
                // SourceVault
                vSecrets.SourceVault    = new Microsoft.Azure.Management.Compute.Models.SubResource();
                vSecrets.SourceVault.Id = this.SourceVaultId;
            }
            vSecrets.VaultCertificates = this.VaultCertificate;
            this.VirtualMachineScaleSet.VirtualMachineProfile.OsProfile.Secrets.Add(vSecrets);
            WriteObject(this.VirtualMachineScaleSet);
        }
        protected override void ProcessRecord()
        {
            // VirtualMachineProfile
            if (this.VirtualMachineScaleSet.VirtualMachineProfile == null)
            {
                this.VirtualMachineScaleSet.VirtualMachineProfile = new Microsoft.Azure.Management.Compute.Models.VirtualMachineScaleSetVMProfile();
            }

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

            // Secrets
            if (this.VirtualMachineScaleSet.VirtualMachineProfile.OsProfile.Secrets == null)
            {
                this.VirtualMachineScaleSet.VirtualMachineProfile.OsProfile.Secrets = new List<Microsoft.Azure.Management.Compute.Models.VaultSecretGroup>();
            }

            var vSecrets = new Microsoft.Azure.Management.Compute.Models.VaultSecretGroup();

            // SourceVault
            vSecrets.SourceVault = new Microsoft.Azure.Management.Compute.Models.SubResource();

            vSecrets.SourceVault.Id = this.SourceVaultId;
            vSecrets.VaultCertificates = this.VaultCertificate;
            this.VirtualMachineScaleSet.VirtualMachineProfile.OsProfile.Secrets.Add(vSecrets);
            WriteObject(this.VirtualMachineScaleSet);
        }
Exemple #4
0
        private void Run()
        {
            WriteWarning("Add-AzureRmVmssSecret: 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();
            }

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

            // Secrets
            if (this.VirtualMachineScaleSet.VirtualMachineProfile.OsProfile.Secrets == null)
            {
                this.VirtualMachineScaleSet.VirtualMachineProfile.OsProfile.Secrets = new List <Microsoft.Azure.Management.Compute.Models.VaultSecretGroup>();
            }

            var vSecrets = new Microsoft.Azure.Management.Compute.Models.VaultSecretGroup();

            if (this.MyInvocation.BoundParameters.ContainsKey("SourceVaultId"))
            {
                // SourceVault
                vSecrets.SourceVault    = new Microsoft.Azure.Management.Compute.Models.SubResource();
                vSecrets.SourceVault.Id = this.SourceVaultId;
            }
            vSecrets.VaultCertificates = this.MyInvocation.BoundParameters.ContainsKey("VaultCertificate") ? this.VaultCertificate : null;
            this.VirtualMachineScaleSet.VirtualMachineProfile.OsProfile.Secrets.Add(vSecrets);
            WriteObject(this.VirtualMachineScaleSet);
        }
        public void SetCertificateInfo(VirtualMachine vm)
        {
            SourceVaultReference vault = GetDefaultSourceVault();

            VaultCertificate vmCert = GetDefaultVaultCert();

            var secretGroup = new VaultSecretGroup() {SourceVault = vault, VaultCertificates = new List<VaultCertificate>(){vmCert}};

            vm.OSProfile.Secrets = new List<VaultSecretGroup>() { secretGroup };
        }