UploadServiceCertificate() 공개 메소드

Uploads a certificate given a valid service certificate and password
public UploadServiceCertificate ( X509Certificate2 certificate, string password = "", bool includePrivateKey = false ) : void
certificate System.Security.Cryptography.X509Certificates.X509Certificate2 The certificate being uploaded
password string The .pfx password for the certificate
includePrivateKey bool The .pfx password for the certificate
리턴 void
예제 #1
0
        private void AddServiceCertificateToRoles(ServiceCertificateModel serviceCertificate, string cloudServiceName, ref List <LinuxVirtualMachineProperties> properties)
        {
            // upload the service certificate if it exists for the ssh keys
            if (serviceCertificate != null)
            {
                var client = new ServiceClient(SubscriptionId, ManagementCertificate, cloudServiceName);
                client.UploadServiceCertificate(serviceCertificate.ServiceCertificate, serviceCertificate.Password, true);
                foreach (var linuxVirtualMachineProperty in properties)
                {
                    linuxVirtualMachineProperty.PublicKeys.Add(new SSHKey(KeyType.PublicKey)
                    {
                        FingerPrint = serviceCertificate.ServiceCertificate.GetCertHashString(),
                        Path        = String.Format("/home/{0}/.ssh/authorized_keys", linuxVirtualMachineProperty.UserName)
                    });
                    linuxVirtualMachineProperty.KeyPairs.Add(new SSHKey(KeyType.KeyPair)
                    {
                        FingerPrint = serviceCertificate.ServiceCertificate.GetCertHashString(),
                        Path        = String.Format("/home/{0}/.ssh/id_rsa", linuxVirtualMachineProperty.UserName)
                    });

                    linuxVirtualMachineProperty.DisableSSHPasswordAuthentication = true;
                }
            }
        }
        private void AddServiceCertificateToRoles(ServiceCertificateModel serviceCertificate, string cloudServiceName, ref List<LinuxVirtualMachineProperties> properties)
        {
            // upload the service certificate if it exists for the ssh keys
            if (serviceCertificate != null)
            {
                var client = new ServiceClient(SubscriptionId, ManagementCertificate, cloudServiceName);
                client.UploadServiceCertificate(serviceCertificate.ServiceCertificate, serviceCertificate.Password, true);
                foreach (var linuxVirtualMachineProperty in properties)
                {
                    linuxVirtualMachineProperty.PublicKeys.Add(new SSHKey(KeyType.PublicKey)
                    {
                        FingerPrint = serviceCertificate.ServiceCertificate.GetCertHashString(),
                        Path = String.Format("/home/{0}/.ssh/authorized_keys", linuxVirtualMachineProperty.UserName)
                    });
                    linuxVirtualMachineProperty.KeyPairs.Add(new SSHKey(KeyType.KeyPair)
                    {
                        FingerPrint = serviceCertificate.ServiceCertificate.GetCertHashString(),
                        Path = String.Format("/home/{0}/.ssh/id_rsa", linuxVirtualMachineProperty.UserName)
                    });

                    linuxVirtualMachineProperty.DisableSSHPasswordAuthentication = true;
                }
            }
        }