次の方法で共有


JavaScript を使用して Azure Key Vault のキーを有効または無効にする

Azure Key Vault の暗号化操作でキーを使用できるようにするには、SecretClient クラスの updateKeyProperties メソッドを使用します。

キーを有効にする

Azure Key Vault でキーを有効にするには、KeyClient クラスの updateKeyProperties メソッドを使用します。

const properties = await keyClient.updateKeyProperties(
    keyName,
    version, // optional, remove to update the latest version
    { enabled: true }
);

完全なコード例については、キー プロパティの更新の例を参照してください。

新しいキーを無効にする

新しいキーを無効にするには、createKey メソッドを使用し、createKeyOptions を使用してキーを無効にします。

const keyVaultKey = await keyClient.createKey(keyName, keyType, { enabled: false });

既存のキーを無効にする

Azure Key Vault でキーを無効にするには、KeyClient クラスの updateKeyProperties メソッドを使用します。

const properties = await keyClient.updateKeyProperties(
    keyName,
    version, // optional, remove to update the latest version
    { enabled: false }
);

完全なコード例については、キー プロパティの更新の例を参照してください。

次のステップ