Unable to setup TDE via Azure SDK for python

I’m trying to setup transparent data encryption on my Azure SQL server with the help of a customer managed key I have stored on my key vault. I’m doing all of this via Azure SDK for python. I’m providing code for the same.

def enable_transparent_data_encryption(server_name: str):
    key_client = KeyClient(vault_url=KEY_VAULT_URL, credential=credentials)
    key_name = create_sql_cmk(server_name)
    key = key_client.get_key(name=key_name)
    key_version = key.properties.version
    server_key_name = f'{KEY_VAULT_URL.split("//")[-1].split(".")[0]}_{key_name}_{key_version}'
    tde = ServerKey(

    sql_client.server_keys.begin_create_or_update(RESOURCE_GROUP_NAME, server_name, server_key_name, tde).wait()
    print(f'Enabled - Transparent Data Encryption using CMK on `{server_name}` SQL server.')

I have tried my code but it doesn’t enable transparent data encryption on my SQL server.

Read more here: Source link