azure-keyvault-keys-ts
管理 Azure Key Vault 金鑰
需要在 Azure 中建立、加密、簽署或輪換密碼編譯金鑰嗎?此技能提供可直接使用的 Azure Key Vault 金鑰 SDK 程式碼片段,以安全地處理金鑰管理。
下載技能 ZIP
在 Claude 中上傳
前往 設定 → 功能 → 技能 → 上傳技能
開啟並開始使用
測試它
正在使用「azure-keyvault-keys-ts」。 Create an EC key named 'signing-key' using P-256 curve
預期結果:
```typescript
const ecKey = await keyClient.createEcKey('signing-key', {
curve: 'P-256',
enabled: true,
keyOps: ['sign', 'verify']
});
console.log('Created key:', ecKey.name);
```
正在使用「azure-keyvault-keys-ts」。 Encrypt the string 'secret-data' using RSA-OAEP
預期結果:
```typescript
const cryptoClient = new CryptographyClient(key, credential);
const encrypted = await cryptoClient.encrypt({
algorithm: 'RSA-OAEP',
plaintext: Buffer.from('secret-data')
});
console.log('Encrypted:', encrypted.result.toString('base64'));
```
安全審計
安全Static analysis flagged 47 potential issues, but all are false positives. The file is legitimate Azure SDK documentation containing example code blocks (not actual executables), placeholder URLs (not real endpoints), and standard environment variable patterns (Azure best practice). No malicious behavior detected.
嚴重問題 (1)
中風險問題 (3)
品質評分
你能建構什麼
雲端應用程式開發人員
使用 Azure Key Vault 進行安全金鑰儲存和管理,在雲端應用程式中實作待用資料加密。
DevOps 工程師
管理金鑰輪換原則,並在 Azure 環境中自動化密碼編譯金鑰生命週期操作。
安全工程師
實作適當的金鑰管理工作流程,包括備份、還原和存取控制,以符合法規遵循要求。
試試這些提示
在 Azure Key Vault 中建立名為 'my-encryption-key' 的新 RSA 金鑰,設定 2048 位元大小。啟用金鑰並設定到期日。
示範如何使用 Azure Key Vault 密碼編譯用戶端搭配 RSA-OAEP 演算法來加密使用者密碼。
為 'my-rotation-key' 設定自動輪換,使其每 90 天輪換一次。顯示輪換原則設定。
如何將金鑰從一個 Azure Key Vault 備份並還原到不同的保存庫?請包含備份和還原操作。
最佳實務
- 使用 DefaultAzureCredential 在開發和生產環境中自動進行驗證
- 在保存庫上啟用軟刪除以防止意外刪除金鑰
- 在金鑰上設定到期日並實作輪換原則以符合安全性法規
避免
- 在原始程式碼中硬編碼連線字串或密碼 - 請使用 Azure Key Vault 或環境變數
- 使用沒有到期日的金鑰 - 務必設定有效期
- 停用金鑰操作日誌 - 稽核軌跡對安全性法規遵循至關重要