diff --git a/sdk/keyvault/azure-keyvault-keys/samples/hello_world_async.py b/sdk/keyvault/azure-keyvault-keys/samples/hello_world_async.py index 4a428991344e..c25e703cead7 100644 --- a/sdk/keyvault/azure-keyvault-keys/samples/hello_world_async.py +++ b/sdk/keyvault/azure-keyvault-keys/samples/hello_world_async.py @@ -49,7 +49,7 @@ async def run_sample(): key_ops = ["encrypt", "decrypt", "sign", "verify", "wrapKey", "unwrapKey"] key_name = "rsaKeyNameAsync" rsa_key = await client.create_rsa_key(key_name, size=key_size, key_operations=key_ops) - print("RSA Key with name '{0}' created of type '{1}'.".format(rsa_key.name, rsa_key.key_type)) + print(f"RSA Key with name '{rsa_key.name}' created of type '{rsa_key.key_type}'.") # Let's create an Elliptic Curve key with algorithm curve type P-256. # if the key already exists in the Key Vault, then a new version of the key is created. @@ -57,12 +57,12 @@ async def run_sample(): key_curve = "P-256" key_name = "ECKeyNameAsync" ec_key = await client.create_ec_key(key_name, curve=key_curve) - print("EC Key with name '{0}' created of type {1}.".format(ec_key.name, ec_key.key_type)) + print(f"EC Key with name '{ec_key.name}' created of type {ec_key.key_type}.") # Let's get the rsa key details using its name print("\n.. Get a Key using it's name") rsa_key = await client.get_key(rsa_key.name) - print("Key with name '{0}' was found.".format(rsa_key.name)) + print(f"Key with name '{rsa_key.name}' was found.") # Let's say we want to update the expiration time for the EC key and disable the key to be usable # for cryptographic operations. The update method allows the user to modify the metadata (key attributes) @@ -72,22 +72,14 @@ async def run_sample(): updated_ec_key = await client.update_key_properties( ec_key.name, version=ec_key.properties.version, expires_on=expires_on, enabled=False ) - print( - "Key with name '{0}' was updated on date '{1}'".format( - updated_ec_key.name, updated_ec_key.properties.updated_on - ) - ) - print( - "Key with name '{0}' was updated to expire on '{1}'".format( - updated_ec_key.name, updated_ec_key.properties.expires_on - ) - ) + print(f"Key with name '{updated_ec_key.name}' was updated on date '{updated_ec_key.properties.updated_on}'") + print(f"Key with name '{updated_ec_key.name}' was updated to expire on '{updated_ec_key.properties.expires_on}'") # The keys are no longer used, let's delete them print("\n.. Deleting keys") for key_name in (ec_key.name, rsa_key.name): deleted_key = await client.delete_key(key_name) - print("\nDeleted '{}'".format(deleted_key.name)) + print(f"\nDeleted '{deleted_key.name}'") print("\nrun_sample done") await credential.close()