mirror of
https://github.com/james-m-jordan/openai-cookbook.git
synced 2025-05-09 19:32:38 +00:00
Update ad auth section
This commit is contained in:
parent
0bd2dcfa5c
commit
934f4d863b
@ -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": {
|
||||
|
@ -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"
|
||||
]
|
||||
},
|
||||
{
|
||||
|
@ -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"
|
||||
]
|
||||
},
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user