/// <summary>
        /// Gets a Server Key Vault Key for a server
        /// </summary>
        /// <param name="resourceGroupName">Name of resource group</param>
        /// <param name="serverName">Name of SQL server</param>
        /// <param name="keyId">KeyId of the Server Key Vault Key</param>
        /// <returns>The Server Key Vault Key</returns>
        public AzureSqlServerKeyVaultKeyModel Get(string resourceGroupName, string serverName, string keyId)
        {
            string keyName = TdeKeyHelper.CreateServerKeyNameFromKeyId(keyId);
            var    resp    = Communicator.Get(resourceGroupName, serverName, keyName);

            return(CreateServerKeyModelFromResponse(resourceGroupName, serverName, keyName, resp));
        }
 public AzureRmSqlManagedInstanceKeyVaultKeyModel(string resourceGroupName, string managedInstanceName, string keyId)
 {
     ResourceGroupName   = resourceGroupName;
     ManagedInstanceName = managedInstanceName;
     KeyId = keyId;
     ManagedInstanceKeyName = TdeKeyHelper.CreateServerKeyNameFromKeyId(keyId);
 }
Esempio n. 3
0
        /// <summary>
        /// Constructs the model to send to the update API
        /// </summary>
        /// <param name="model">The result of the get operation</param>
        /// <returns>The model to send to the update</returns>
        protected override IEnumerable <Model.AzureSqlServerTransparentDataEncryptionProtectorModel> ApplyUserInputToModel(IEnumerable <Model.AzureSqlServerTransparentDataEncryptionProtectorModel> model)
        {
            List <Model.AzureSqlServerTransparentDataEncryptionProtectorModel> newEntity = new List <Model.AzureSqlServerTransparentDataEncryptionProtectorModel>();

            newEntity.Add(new Model.AzureSqlServerTransparentDataEncryptionProtectorModel()
            {
                ResourceGroupName = this.ResourceGroupName,
                ServerName        = this.ServerName,
                Type = this.Type,
                ServerKeyVaultKeyName = TdeKeyHelper.CreateServerKeyNameFromKeyId(this.KeyId),
                KeyId = this.KeyId
            });
            return(newEntity);
        }
        /// <summary>
        /// Generates the model from user input.
        /// </summary>
        /// <param name="model">This is null since the model doesn't exist yet</param>
        /// <returns>The generated model from user input</returns>
        protected override IEnumerable <AzureSqlServerKeyVaultKeyModel> ApplyUserInputToModel(IEnumerable <AzureSqlServerKeyVaultKeyModel> model)
        {
            List <AzureSqlServerKeyVaultKeyModel> newEntity = new List <AzureSqlServerKeyVaultKeyModel>();

            newEntity.Add(new AzureSqlServerKeyVaultKeyModel()
            {
                ResourceGroupName = this.ResourceGroupName,
                ServerName        = this.ServerName,
                ServerKeyName     = TdeKeyHelper.CreateServerKeyNameFromKeyId(this.KeyId),
                Uri  = this.KeyId,
                Type = AzureSqlServerKeyVaultKeyModel.ServerKeyType.AzureKeyVault
            });

            return(newEntity);
        }
Esempio n. 5
0
        public AzureRmSqlManagedInstanceTransparentDataEncryptionProtectorModel CreateOrUpdateManagedInstanceEncryptionProtector(AzureRmSqlManagedInstanceTransparentDataEncryptionProtectorModel model)
        {
            ManagedInstanceEncryptionProtector managedInstanceEncryptionProtector = Communicator.CreateOrUpdateManagedInstanceEncryptionProtector(
                resourceGroupName: model.ResourceGroupName,
                managedInstanceName: model.ManagedInstanceName,
                managedInstanceEncryptionProtector: new ManagedInstanceEncryptionProtector()
            {
                ServerKeyType = model.Type.ToString(),
                ServerKeyName = TdeKeyHelper.CreateServerKeyNameFromKeyId(model.KeyId)
            });

            return(AzureRmSqlManagedInstanceTransparentDataEncryptionProtectorModel
                   .FromManagedInstanceEncryptionProtector(
                       resourceGroupName: model.ResourceGroupName,
                       managedInstanceName: model.ManagedInstanceName,
                       managedInstanceEncryptionProtector: managedInstanceEncryptionProtector));
        }
        /// <summary>
        /// Deletes a Server Key Vault Key
        /// </summary>
        /// <param name="resourceGroupName">Name of resource group</param>
        /// <param name="serverName">Name of SQL server</param>
        /// <param name="keyId">KeyId of the Server Key Vault Key</param>
        public void Delete(string resourceGroupName, string serverName, string keyId)
        {
            string keyName = TdeKeyHelper.CreateServerKeyNameFromKeyId(keyId);

            Communicator.Delete(resourceGroupName, serverName, keyName);
        }