You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
"\u001b[?1h\u001b=\u001b[93mA new Bicep release is available: v0.43.8. Upgrade now by running \"az bicep upgrade\".\u001b[0m\n",
341
341
"\u001b[?1h\u001b=\u001b[93m<repo-root>/08-agents/08-03-hosted-agents/main.bicep(41,9) : Warning BCP334: The provided value can have a length as small as 3 and may be too short to assign to a target with a configured minimum length of 5. [https://aka.ms/bicep/core-diagnostics#BCP334]\n",
Copy file name to clipboardExpand all lines: 08-agents/08-05b-contoso-private-banking-mcp/08-05b-01-private-banking-agent-setup.ipynb
+1-1Lines changed: 1 addition & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -259,7 +259,7 @@
259
259
" ERROR: Cannot change the site func-private-banking-mcp-97aab2 to the App Service Plan ASP-rgfoundryprivatebankingmcp-c0e3 due to hosting constraints.\n",
260
260
" … waiting 30 s for managed identity to initialize...\n",
261
261
"Assigning storage roles to managed identity...\n",
"source": "# Derive APIM name and suffix from GATEWAY_URL\n# e.g. https://apim-foundry-{suffix}.azure-api.net/openai -> apim-foundry-{suffix}\nAPIM_NAME = GATEWAY_URL.split('//')[1].split('.')[0]\nSUFFIX = APIM_NAME.split('-')[-1] # e.g. {suffix}\nCORE_RG = f'rg-foundry-core-{SUFFIX}'\n\n# Subscription ID + ARM base URI used by Steps 3 and 5 to call APIM management\n# endpoints directly via `az rest`. This avoids requiring the `az apim` CLI\n# extension, which is not bundled with the base Azure CLI.\nSUB_ID = subprocess.run(\n 'az account show --query id -o tsv', shell=True, capture_output=True, text=True\n).stdout.strip()\nAPIM_BASE_URI = (\n f'https://management.azure.com/subscriptions/{SUB_ID}'\n f'/resourceGroups/{CORE_RG}/providers/Microsoft.ApiManagement/service/{APIM_NAME}'\n)\n\n# Get deployer principal ID from cached JWT\ntoken = subprocess.run(\n 'az account get-access-token --query accessToken -o tsv',\n shell=True, capture_output=True, text=True\n).stdout.strip()\npadding = '=' * (4 - len(token.split('.')[1]) % 4)\nPRINCIPAL_ID = json.loads(base64.b64decode(token.split('.')[1] + padding))['oid']\n\nprint(f'APIM service : {APIM_NAME}')\nprint(f'Core RG : {CORE_RG}')\nprint(f'Subscription : {SUB_ID}')\nprint(f'Principal ID : {PRINCIPAL_ID}')"
" print(' Proceeding to read existing resources.')\n",
175
+
"else:\n",
176
+
" print('ℹ️ openai-research backend not found - will deploy main.bicep.')"
177
+
]
105
178
},
106
179
{
107
180
"cell_type": "markdown",
@@ -115,10 +188,18 @@
115
188
},
116
189
{
117
190
"cell_type": "code",
118
-
"execution_count": null,
191
+
"execution_count": 4,
119
192
"id": "12010001-0000-0000-0000-000000000009",
120
193
"metadata": {},
121
-
"outputs": [],
194
+
"outputs": [
195
+
{
196
+
"name": "stdout",
197
+
"output_type": "stream",
198
+
"text": [
199
+
"ℹ️ Skipped (backend already exists)\n"
200
+
]
201
+
}
202
+
],
122
203
"source": [
123
204
"if not BACKEND_EXISTS:\n",
124
205
" result = subprocess.run(\n",
@@ -152,11 +233,48 @@
152
233
},
153
234
{
154
235
"cell_type": "code",
155
-
"execution_count": null,
236
+
"execution_count": 5,
156
237
"id": "12010001-0000-0000-0000-000000000011",
157
238
"metadata": {},
158
-
"outputs": [],
159
-
"source": "# Try the dedicated deep research subscription first; fall back to the alpha\n# subscription if it doesn't exist yet. Uses `az rest` against ARM directly,\n# matching the pattern in 10-01 and 11-01, so the `az apim` extension is not needed.\ndef _list_apim_subscription_key(sub_name: str) -> str | None:\n r = subprocess.run(\n f'az rest --method POST'\n f' --uri \"{APIM_BASE_URI}/subscriptions/{sub_name}/listSecrets?api-version=2024-06-01-preview\"'\n f' --query primaryKey -o tsv',\n shell=True, capture_output=True, text=True\n )\n return r.stdout.strip() if r.returncode == 0 and r.stdout.strip() else None\n\nDR_GATEWAY_KEY = _list_apim_subscription_key('foundry-gateway-dr')\nif DR_GATEWAY_KEY:\n print('✅ Using foundry-gateway-dr subscription key')\nelse:\n DR_GATEWAY_KEY = _list_apim_subscription_key('foundry-gateway-alpha')\n if DR_GATEWAY_KEY:\n print('ℹ️ Using foundry-gateway-alpha subscription key (fallback)')\n else:\n raise RuntimeError('Could not retrieve APIM subscription key. Check az login and core RG.')\n\nDR_MODEL = 'o3-deep-research'\n\nprint(f'DR model : {DR_MODEL}')\nprint(f'DR key : {DR_GATEWAY_KEY[:4]}... (hidden)')"
239
+
"outputs": [
240
+
{
241
+
"name": "stdout",
242
+
"output_type": "stream",
243
+
"text": [
244
+
"ℹ️ Using foundry-gateway-alpha subscription key (fallback)\n",
245
+
"DR model : o3-deep-research\n",
246
+
"DR key : 8382... (hidden)\n"
247
+
]
248
+
}
249
+
],
250
+
"source": [
251
+
"# Try the dedicated deep research subscription first; fall back to the alpha\n",
252
+
"# subscription if it doesn't exist yet. Uses `az rest` against ARM directly,\n",
253
+
"# matching the pattern in 10-01 and 11-01, so the `az apim` extension is not needed.\n",
0 commit comments