public UploadServiceCertificate ( |
||
certificate | The certificate being uploaded | |
password | string | The .pfx password for the certificate |
includePrivateKey | bool | The .pfx password for the certificate |
return | void |
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; } } }