你当前正在访问 Microsoft Azure Global Edition 技术文档网站。 如果需要访问由世纪互联运营的 Microsoft Azure 中国技术文档网站,请访问 https://docs.azure.cn

KeysOperations Class

Warning

DO NOT instantiate this class directly.

Instead, you should access the following operations through

KeyVaultManagementClient's

<xref:keys> attribute.

Inheritance
builtins.object
KeysOperations

Constructor

KeysOperations(*args, **kwargs)

Methods

create_if_not_exist

Creates the first version of a new key if it does not exist. If it already exists, then the existing key is returned without any write operations being performed. This API does not create subsequent versions, and does not update existing keys.

get

Gets the current version of the specified key from the specified key vault.

get_version

Gets the specified version of the specified key in the specified key vault.

list

Lists the keys in the specified key vault.

list_versions

Lists the versions of the specified key in the specified key vault.

create_if_not_exist

Creates the first version of a new key if it does not exist. If it already exists, then the existing key is returned without any write operations being performed. This API does not create subsequent versions, and does not update existing keys.

create_if_not_exist(resource_group_name: str, vault_name: str, key_name: str, parameters: _models.KeyCreateParameters, *, content_type: str = 'application/json', **kwargs: Any) -> _models.Key

Parameters

Name Description
resource_group_name
Required
str

The name of the resource group which contains the specified key vault. Required.

vault_name
Required
str

The name of the key vault which contains the key to be created. Required.

key_name
Required
str

The name of the key to be created. The value you provide may be copied globally for the purpose of running the service. The value provided should not include personally identifiable or sensitive information. Required.

parameters
Required

The parameters used to create the specified key. Is either a KeyCreateParameters type or a IO[bytes] type. Required.

Returns

Type Description
Key

Key or the result of cls(response)

Exceptions

Type Description

get

Gets the current version of the specified key from the specified key vault.

get(resource_group_name: str, vault_name: str, key_name: str, **kwargs: Any) -> Key

Parameters

Name Description
resource_group_name
Required
str

The name of the resource group which contains the specified key vault. Required.

vault_name
Required
str

The name of the vault which contains the key to be retrieved. Required.

key_name
Required
str

The name of the key to be retrieved. Required.

Returns

Type Description
Key

Key or the result of cls(response)

Exceptions

Type Description

get_version

Gets the specified version of the specified key in the specified key vault.

get_version(resource_group_name: str, vault_name: str, key_name: str, key_version: str, **kwargs: Any) -> Key

Parameters

Name Description
resource_group_name
Required
str

The name of the resource group which contains the specified key vault. Required.

vault_name
Required
str

The name of the vault which contains the key version to be retrieved. Required.

key_name
Required
str

The name of the key version to be retrieved. Required.

key_version
Required
str

The version of the key to be retrieved. Required.

Returns

Type Description
Key

Key or the result of cls(response)

Exceptions

Type Description

list

Lists the keys in the specified key vault.

list(resource_group_name: str, vault_name: str, **kwargs: Any) -> Iterable[Key]

Parameters

Name Description
resource_group_name
Required
str

The name of the resource group which contains the specified key vault. Required.

vault_name
Required
str

The name of the vault which contains the keys to be retrieved. Required.

Returns

Type Description

An iterator like instance of either Key or the result of cls(response)

Exceptions

Type Description

list_versions

Lists the versions of the specified key in the specified key vault.

list_versions(resource_group_name: str, vault_name: str, key_name: str, **kwargs: Any) -> Iterable[Key]

Parameters

Name Description
resource_group_name
Required
str

The name of the resource group which contains the specified key vault. Required.

vault_name
Required
str

The name of the vault which contains the key versions to be retrieved. Required.

key_name
Required
str

The name of the key versions to be retrieved. Required.

Returns

Type Description

An iterator like instance of either Key or the result of cls(response)

Exceptions

Type Description

Attributes

models

models = <module 'azure.mgmt.keyvault.v2023_07_01.models' from 'C:\\hostedtoolcache\\windows\\Python\\3.11.9\\x64\\Lib\\site-packages\\azure\\mgmt\\keyvault\\v2023_07_01\\models\\__init__.py'>