Update ad auth section

pull/1077/head
Christian Muertz 2 years ago
parent 0fba046b9b
commit f460efd2b8

@ -67,7 +67,7 @@
"metadata": {}, "metadata": {},
"source": [ "source": [
"### (Optional) Setup: Microsoft Active Directory Authentication\n", "### (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": {}, "metadata": {},
"outputs": [], "outputs": [],
"source": [ "source": [
"\"\"\"\n", "# from azure.identity import DefaultAzureCredential\n",
"from azure.identity import DefaultAzureCredential\n",
"\n", "\n",
"default_credential = DefaultAzureCredential()\n", "# default_credential = DefaultAzureCredential()\n",
"token = default_credential.get_token(\"https://cognitiveservices.azure.com/.default\")\n", "# token = default_credential.get_token(\"https://cognitiveservices.azure.com/.default\")\n",
"\n", "\n",
"openai.api_type = 'azure_ad'\n", "# openai.api_type = 'azure_ad'\n",
"openai.api_key = token.token\n", "# openai.api_key = token.token"
"\"\"\""
] ]
}, },
{ {
@ -191,6 +189,13 @@
"print(f'Deleting deployment: {deployment_id}')\n", "print(f'Deleting deployment: {deployment_id}')\n",
"openai.Deployment.delete(sid=deployment_id)" "openai.Deployment.delete(sid=deployment_id)"
] ]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
} }
], ],
"metadata": { "metadata": {

@ -72,7 +72,7 @@
"metadata": {}, "metadata": {},
"source": [ "source": [
"### (Optional) Setup: Microsoft Active Directory Authentication\n", "### (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": {}, "metadata": {},
"outputs": [], "outputs": [],
"source": [ "source": [
"\"\"\"\n", "# from azure.identity import DefaultAzureCredential\n",
"from azure.identity import DefaultAzureCredential\n",
"\n", "\n",
"default_credential = DefaultAzureCredential()\n", "# default_credential = DefaultAzureCredential()\n",
"token = default_credential.get_token(\"https://cognitiveservices.azure.com/.default\")\n", "# token = default_credential.get_token(\"https://cognitiveservices.azure.com/.default\")\n",
"\n", "\n",
"openai.api_type = 'azure_ad'\n", "# openai.api_type = 'azure_ad'\n",
"openai.api_key = token.token\n", "# openai.api_key = token.token"
"\"\"\""
] ]
}, },
{ {

@ -68,7 +68,7 @@
"metadata": {}, "metadata": {},
"source": [ "source": [
"### (Optional) Setup: Microsoft Active Directory Authentication\n", "### (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": {}, "metadata": {},
"outputs": [], "outputs": [],
"source": [ "source": [
"\"\"\"\n", "# from azure.identity import DefaultAzureCredential\n",
"from azure.identity import DefaultAzureCredential\n",
"\n", "\n",
"default_credential = DefaultAzureCredential()\n", "# default_credential = DefaultAzureCredential()\n",
"token = default_credential.get_token(\"https://cognitiveservices.azure.com/.default\")\n", "# token = default_credential.get_token(\"https://cognitiveservices.azure.com/.default\")\n",
"\n", "\n",
"openai.api_type = 'azure_ad'\n", "# openai.api_type = 'azure_ad'\n",
"openai.api_key = token.token\n", "# openai.api_key = token.token"
"\"\"\""
] ]
}, },
{ {

Loading…
Cancel
Save