Update ad auth section

This commit is contained in:
Christian Muertz 2022-12-20 16:50:42 +01:00
parent 0bd2dcfa5c
commit 934f4d863b
3 changed files with 25 additions and 24 deletions

View File

@ -67,7 +67,7 @@
"metadata": {},
"source": [
"### (Optional) Setup: Microsoft Active Directory Authentication\n",
"Let's now see how we can get a key via Microsoft Active Directory Authentication."
"Let's now see how we can get a key via Microsoft Active Directory Authentication. Uncomment the following code if you want to use Active Directory Authentication instead of keys from the portal."
]
},
{
@ -76,15 +76,13 @@
"metadata": {},
"outputs": [],
"source": [
"\"\"\"\n",
"from azure.identity import DefaultAzureCredential\n",
"# from azure.identity import DefaultAzureCredential\n",
"\n",
"default_credential = DefaultAzureCredential()\n",
"token = default_credential.get_token(\"https://cognitiveservices.azure.com/.default\")\n",
"# default_credential = DefaultAzureCredential()\n",
"# token = default_credential.get_token(\"https://cognitiveservices.azure.com/.default\")\n",
"\n",
"openai.api_type = 'azure_ad'\n",
"openai.api_key = token.token\n",
"\"\"\""
"# openai.api_type = 'azure_ad'\n",
"# openai.api_key = token.token"
]
},
{
@ -191,6 +189,13 @@
"print(f'Deleting deployment: {deployment_id}')\n",
"openai.Deployment.delete(sid=deployment_id)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {

View File

@ -72,7 +72,7 @@
"metadata": {},
"source": [
"### (Optional) Setup: Microsoft Active Directory Authentication\n",
"Let's now see how we can get a key via Microsoft Active Directory Authentication."
"Let's now see how we can get a key via Microsoft Active Directory Authentication. Uncomment the following code if you want to use Active Directory Authentication instead of keys from the portal."
]
},
{
@ -81,15 +81,13 @@
"metadata": {},
"outputs": [],
"source": [
"\"\"\"\n",
"from azure.identity import DefaultAzureCredential\n",
"# from azure.identity import DefaultAzureCredential\n",
"\n",
"default_credential = DefaultAzureCredential()\n",
"token = default_credential.get_token(\"https://cognitiveservices.azure.com/.default\")\n",
"# default_credential = DefaultAzureCredential()\n",
"# token = default_credential.get_token(\"https://cognitiveservices.azure.com/.default\")\n",
"\n",
"openai.api_type = 'azure_ad'\n",
"openai.api_key = token.token\n",
"\"\"\""
"# openai.api_type = 'azure_ad'\n",
"# openai.api_key = token.token"
]
},
{

View File

@ -68,7 +68,7 @@
"metadata": {},
"source": [
"### (Optional) Setup: Microsoft Active Directory Authentication\n",
"Let's now see how we can get a key via Microsoft Active Directory Authentication."
"Let's now see how we can get a key via Microsoft Active Directory Authentication. Uncomment the following code if you want to use Active Directory Authentication instead of keys from the portal."
]
},
{
@ -77,15 +77,13 @@
"metadata": {},
"outputs": [],
"source": [
"\"\"\"\n",
"from azure.identity import DefaultAzureCredential\n",
"# from azure.identity import DefaultAzureCredential\n",
"\n",
"default_credential = DefaultAzureCredential()\n",
"token = default_credential.get_token(\"https://cognitiveservices.azure.com/.default\")\n",
"# default_credential = DefaultAzureCredential()\n",
"# token = default_credential.get_token(\"https://cognitiveservices.azure.com/.default\")\n",
"\n",
"openai.api_type = 'azure_ad'\n",
"openai.api_key = token.token\n",
"\"\"\""
"# openai.api_type = 'azure_ad'\n",
"# openai.api_key = token.token"
]
},
{