Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Azure App Configuration と Key Vault の連携
Search
Sponsored
·
Your Podcast. Everywhere. Effortlessly.
Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
→
Hajime
June 19, 2022
Programming
750
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Azure App Configuration と Key Vault の連携
Hajime
June 19, 2022
More Decks by Hajime
See All by Hajime
Azure API Management の使い方
hajimes
0
3.7k
Static Web App の使い方
hajimes
0
2.5k
Azure Functions で SQL Database のデータを操作する API を作成する手順
hajimes
0
1k
Other Decks in Programming
See All in Programming
CSC307 Lecture 17
javiergs
PRO
0
320
Developing with AI Agents — Codex, Claude Code & Cowork Practical Guide
x5gtrn
PRO
0
1.2k
Hunting Vulnerabilities in Symfony with LLMs
vinceamstoutz
0
540
Vue × Nuxt × Oxc どこまで使える?実運用の現在地
andpad
0
160
Claspは野良GASの夢をみるか
takter00
0
180
Vite+ Unified Toolchain for the Web
naokihaba
0
240
「AIで開発し、AIを届ける」をEvalでつなぐ 〜AIネイティブに始めるプロダクト開発の実践〜 / Connecting "Develop with AI, deliver AI" with Eval
rkaga
4
4.9k
DynamoDBには集計系のクエリがないけどなんとかしたい
musan
1
130
AutonomyとControlのあいだ:Graflowで記述するAIエージェント協調
myui
0
120
Old Dog, New Tricks: The Java 25 Reinvention - JNation
bazlur_rahman
0
150
気づいたらRubyで100作品 ー クリエイティブコーディングが生活の一部になるまで / 100 Ruby Sketches Later: How Creative Coding Became Part of My Life
chobishiba
3
560
コンテキストの使い捨てをやめる — ビジネスルール駆動開発と miko —
ioki
0
180
Featured
See All Featured
Primal Persuasion: How to Engage the Brain for Learning That Lasts
tmiket
0
360
Amusing Abliteration
ianozsvald
1
200
Unlocking the hidden potential of vector embeddings in international SEO
frankvandijk
0
840
世界の人気アプリ100個を分析して見えたペイウォール設計の心得
akihiro_kokubo
PRO
71
40k
BBQ
matthewcrist
89
10k
Being A Developer After 40
akosma
91
590k
Evolving SEO for Evolving Search Engines
ryanjones
0
210
How To Stay Up To Date on Web Technology
chriscoyier
790
250k
Optimising Largest Contentful Paint
csswizardry
37
3.7k
The Mindset for Success: Future Career Progression
greggifford
PRO
0
360
Building Better People: How to give real-time feedback that sticks.
wjessup
370
20k
The agentic SEO stack - context over prompts
schlessera
0
810
Transcript
Azure App Configuration と Key Vault の連携 (Node.JS 編) (c)
2022 hajimes.life
1. 前提条件と構成 • 実現したいこと • アプリで App Configuration に関連 づけられた
Key Vault のシークレッ ト情報を取得すること • Azure サービス • App Configuration: アプリケーショ ンの設定情報などを⼀元的に管理 • Key Vault: アプリケーションのシー クレット情報などを暗号化して管理 • 実⾏環境 • 処理の流れ 1. Key Vault に値を保存 2. App Configuration に Key Vault への参照情報を登録 3. App Configuration から参照先の Key Vault 情報を取得 4. Key Vault から値を取得 (c) 2022 hajimes.life 環境名 バージョン MacOS 12.4 (Intel) Node.JS v16.15.1 App Configuration Key Vault クライアント 3. 参照先 Key Vault 情報を取得 4. 値を取得 1. Key Vault に値を保存 2. Key Vault への参照情報を登録
2. 今回利⽤する Azure サービスについて App Configuration • 概要︓アプリの設定情報や機能フラ グを⼀元的に管理するサービス。開 発と本番など同じアプリを複数設置
した際の設定ミスを防ぐ • 料⾦︓Free 今回の構成では機能的に Free プラ ンでも実現可能 実運⽤に向けては SLA の定義がなく 1 ⽇のアクセス頻度が 1,000 回なた め Standard プランにした⽅が無難 Key Vault • 概要︓サービスのシークレットや サーバ証明書などの秘匿情報を暗号 化してセキュアに管理するサービス • 料⾦︓Standard 今回の構成では「秘密情報の操作」 のみが課⾦対象となり、 1 万回操作 して $0.03 のコストが発⽣ Standard プランでも SLA が 99.99% で提供されているため、実 運⽤でもプランの変更は不要 (c) 2022 hajimes.life App Configuration の価格 https://azure.microsoft.com/ja-jp/pricing/details/app-configuration/ Key Vault の価格 https://azure.microsoft.com/ja-jp/pricing/details/key-vault/
Key Vault / App Configuration の設定⼿順 1. Key Vault の設定
1. Key Vault の作成 2. 「Secrets」メニューを選択して 「Generate/Import」ボタンを押 す 3. 表⽰された「Create a secret」画 ⾯で必要な項⽬を⼊⼒し作成 2. App Configuration の設定 1. App Configuration の作成 2. 「Configuration Explorer」メ ニューを選択して「Create」ボタ ンを押し「Key Vault reference」 を選択 3. 表⽰された「Create」画⾯で参照 先となる Key Vault のシークレッ トを選択して「Apply」ボタンを 押す (c) 2022 hajimes.life
クライアント側での値の取得⼿順 1. App Configuration から Key Vault の格納先情報を取得 • 事前に
App Configuration の接続⽂ 字列と構成名を取得しておく • 上記のコードで retrievedSetting の value に Key Vault の URI が格納 されている 2. URI から Key Vault に格納さ れているシークレットを取得 • 事前に Key Vault のシークレット名 を取得しておく • 上記コードで secret に値が格納さ れている (c) 2022 hajimes.life const appConfig = require('@azure/app-configurationʼ); const appConfClient = new appConfig.AppConfigurationClient(AC_CONN_STR); const retrievedSetting = await appConfClient.getConfigurationSetting({ key: AC_KEY_NAME }); AC_CONN_STR: App Configuration 接続⽂字列 AC_KEY_NAME: 構成名 const kvUri = new URL(JSON.parse(retrievedSetting.value).uri); const credential = new DefaultAzureCredential(); const kvClient = new SecretClient(kvUri.protocol + '//' + kvUri.hostname, credential); const secret = await kvClient.getSecret(KEY_VAULT_SECRET_NAME); KEY_VAULT_SECRET_NAME: シークレット名
(c) 2022 hajimes.life