/// <summary>
 /// Initializes a new instance of the CertificateCreateParameters class
 /// with required arguments.
 /// </summary>
 public CertificateCreateParameters(string name, CertificateCreateProperties properties)
     : this()
 {
     if (name == null)
     {
         throw new ArgumentNullException("name");
     }
     if (properties == null)
     {
         throw new ArgumentNullException("properties");
     }
     this.Name = name;
     this.Properties = properties;
 }
 /// <summary>
 /// Initializes a new instance of the CertificateCreateParameters class
 /// with required arguments.
 /// </summary>
 public CertificateCreateParameters(string name, CertificateCreateProperties properties)
     : this()
 {
     if (name == null)
     {
         throw new ArgumentNullException("name");
     }
     if (properties == null)
     {
         throw new ArgumentNullException("properties");
     }
     this.Name       = name;
     this.Properties = properties;
 }
        private Certificate CreateCertificateInternal(string automationAccountName, string name, string path,
            SecureString password, string description, bool exportable)
        {
            var cert = (password == null)
                ? new X509Certificate2(path, String.Empty, X509KeyStorageFlags.Exportable | X509KeyStorageFlags.PersistKeySet | X509KeyStorageFlags.MachineKeySet)
                : new X509Certificate2(path, password, X509KeyStorageFlags.Exportable | X509KeyStorageFlags.PersistKeySet | X509KeyStorageFlags.MachineKeySet);

            var ccprop = new CertificateCreateProperties()
            {
                Description = description,
                Base64Value = Convert.ToBase64String(cert.Export(X509ContentType.Pkcs12)),
                Thumbprint = cert.Thumbprint,
                IsExportable = exportable
            };

            var ccparam = new CertificateCreateParameters() { Name = name, Properties = ccprop };

            var certificate = this.automationManagementClient.Certificates.Create(automationAccountName, ccparam).Certificate;

            return new Certificate(automationAccountName, certificate);
        }