Skip to content
8 changes: 4 additions & 4 deletions 066-OpenAIFundamentals/Student/Challenge-00.md
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ Now we will deploy the needed large language models from Azure OpenAI.
- On the left navigation bar, under My Assets, click on Models + endpoints. Click the Deploy Model button and select Deploy base model
- Deploy the following 3 models in your Azure OpenAI resource.
- `gpt-4o`
- `gpt-35-turbo`
- `gpt-4o-mini`
- `text-embedding-ada-002`

#### Setup Jupyter Notebooks Configuration File
Expand All @@ -168,11 +168,11 @@ You will find the `.env.sample` file in the root of the codespace. If you are wo
- Navigate to your project. In the lower left corner, click on the link to Management Center. It is also under Project details.
- Click on Connected resources under your project
- Click the name of your Azure OpenAI Service to see its details. Copy the Target URL and API Key for `OPENAI_API_BASE` and `OPEN_API_KEY`, respectively into the `.env` file
- From the **`Manage connect resources in this project`** screen, click the Name with the type **`AIServices`**. Copy the Target URL and the API Key for `AZURE_FORM_RECOGNIZER_ENDPOINT` and `AZURE_FORM_RECOGNIZER_KEY`, respectively into the `.env` file
- From the **`Manage connect resources in this project`** screen, click the Name with the type **`AIServices`**. The AI Services deployment is a multi-service resource that allows you to access multiple Azure AI services like Document Intelligence with a single key and endpoint. Copy the Target URL and the API Key for `AZURE_DOC_INTELLIGENCE_ENDPOINT` and `AZURE_DOC_INTELLIGENCE_KEY`, respectively into the `.env` file
- In the [Azure Portal](portal.azure.com), navigate to the resource group you made when creating your hub within the AI Foundry.
- Locate your **AI Search** service that you created earlier
- From the **Overview**, copy the URL for `AZURE_COGNITIVE_SEARCH_ENDPOINT` in the .env file
- Under **`Settings`** go to Keys, copy the admin key into `AZURE_COGNITIVE_SEARCH_KEY` in the `.env` file
- From the **Overview**, copy the URL for `AZURE_AI_SEARCH_ENDPOINT` in the .env file
- Under **`Settings`** go to Keys, copy the admin key into `AZURE_AI_SEARCH_KEY` in the `.env` file
- Model deployment names should be the same as the ones populated in the `.env.sample` file especially if you have deployed a different model due to quota issues.
- For **Azure Blob**, you can find these credentials in the [Azure Portal](portal.azure.com).
- In the Azure Portal, navigate to the resource group you made when creating your hub within the AI Foundry.
Expand Down
6 changes: 3 additions & 3 deletions 066-OpenAIFundamentals/Student/Resources/infra/deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -117,8 +117,8 @@ source $environment_sample_file
echo "Populating .env file..."
echo "OPENAI_API_KEY=\"$(echo "$json" | jq -r '.deploymentInfo.value.aiServicesKey')\"" >> $environment_file
echo "OPENAI_API_BASE=\"$(echo "$json" | jq -r '.deploymentInfo.value.aiServicesOpenAiEndpoint')\"" >> $environment_file
echo "AZURE_COGNITIVE_SEARCH_KEY=\"$(echo "$json" | jq -r '.deploymentInfo.value.searchKey')\"" >> $environment_file
echo "AZURE_COGNITIVE_SEARCH_ENDPOINT=\"$(echo "$json" | jq -r '.deploymentInfo.value.searchEndpoint')\"" >> $environment_file
echo "AZURE_AI_SEARCH_KEY=\"$(echo "$json" | jq -r '.deploymentInfo.value.searchKey')\"" >> $environment_file
echo "AZURE_AI_SEARCH_ENDPOINT=\"$(echo "$json" | jq -r '.deploymentInfo.value.searchEndpoint')\"" >> $environment_file
echo "DOCUMENT_INTELLIGENCE_ENDPOINT=\"$(echo "$json" | jq -r '.deploymentInfo.value.documentEndpoint')\"" >> $environment_file
echo "DOCUMENT_INTELLIGENCE_KEY=\"$(echo "$json" | jq -r '.deploymentInfo.value.documentKey')\"" >> $environment_file
echo "AZURE_BLOB_STORAGE_ACCOUNT_NAME=\"$(echo "$json" | jq -r '.deploymentInfo.value.storageAccountName')\"" >> $environment_file
Expand All @@ -128,7 +128,7 @@ echo "AZURE_BLOB_STORAGE_CONNECTION_STRING=\"$(echo "$json" | jq -r '.deployment
echo "CHAT_MODEL_NAME=\"$CHAT_MODEL_NAME\"" >> $environment_file
echo "CHAT_MODEL_NAME2=\"$CHAT_MODEL_NAME2\"" >> $environment_file
echo "OPENAI_API_TYPE=\"$OPENAI_API_TYPE\"" >> $environment_file
echo "TEXT_DEPLOYMENT_ID=\"$TEXT_DEPLOYMENT_ID\"" >> $environment_file
echo "CHAT_MODEL_NAME=\"$CHAT_MODEL_NAME\"" >> $environment_file
echo "OPENAI_API_VERSION=\"$OPENAI_API_VERSION\"" >> $environment_file
echo "EMBEDDING_MODEL_NAME=\"$EMBEDDING_MODEL_NAME\"" >> $environment_file

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ resource cognitiveServicesOpenAIUserRoleDefinition 'Microsoft.Authorization/role
name: '5e0bd9bd-7b93-4f28-af87-19fc36ad61bd'
scope: subscription()
}

// This role assignment grants the user the required permissions to eventually delete and purge the Azure AI Services account
// https://learn.microsoft.com/en-us/azure/ai-services/openai/how-to/role-based-access-control#cognitive-services-contributor
resource cognitiveServicesContributorRoleAssignment 'Microsoft.Authorization/roleAssignments@2022-04-01' = if (!empty(userObjectId)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -134,11 +134,27 @@ resource project 'Microsoft.MachineLearningServices/workspaces@2024-04-01-previe
}
}

resource azureAIDeveloperRoleDefinition 'Microsoft.Authorization/roleDefinitions@2022-04-01' existing = {
name: '64702f94-c441-49e6-a78b-ef80e0188fee'
scope: subscription()
}

resource azureMLDataScientistRole 'Microsoft.Authorization/roleDefinitions@2022-04-01' existing = {
name: 'f6c7c914-8db3-469d-8ca1-694a8f32e121'
scope: subscription()
}

// This resource defines the Azure AI Developer role, which provides permissions for managing Azure AI resources, including deployments and configurations
resource aiDeveloperRoleAssignment 'Microsoft.Authorization/roleAssignments@2022-04-01' = if (!empty(userObjectId)) {
name: guid(project.id, azureAIDeveloperRoleDefinition.id, userObjectId)
scope: project
properties: {
roleDefinitionId: azureAIDeveloperRoleDefinition.id
principalType: 'User'
principalId: userObjectId
}
}

// This role assignment grants the user the required permissions to start a Prompt Flow in a compute service within Azure AI Foundry
resource azureMLDataScientistUserRoleAssignment 'Microsoft.Authorization/roleAssignments@2022-04-01' = if (!empty(userObjectId)) {
name: guid(project.id, azureMLDataScientistRole.id, userObjectId)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ param allowStorageAccountPublicAccess string = 'Enabled'
param allowBlobPublicAccess bool = false

@description('Specifies whether the storage account allows shared key access. The default value is false.')
param allowSharedKeyAccess bool = false
param allowSharedKeyAccess bool = true

@description('Specifies whether the storage account allows cross-tenant replication. The default value is false.')
param allowCrossTenantReplication bool = false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -167,8 +167,8 @@
"outputs": [],
"source": [
"# Create a Cognitive Search Index client\n",
"service_endpoint = os.getenv(\"AZURE_COGNITIVE_SEARCH_ENDPOINT\") \n",
"key = os.getenv(\"AZURE_COGNITIVE_SEARCH_KEY\")\n",
"service_endpoint = os.getenv(\"AZURE_AI_SEARCH_ENDPOINT\") \n",
"key = os.getenv(\"AZURE_AI_SEARCH_KEY\")\n",
"credential = AzureKeyCredential(key)\n",
"\n",
"index_name = \"news-index\"\n",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@
"metadata": {},
"outputs": [],
"source": [
"! pip install \"tiktoken==0.4.0\" "
]
"! pip install \"tiktoken==0.9.0\" "
]
},
{
"cell_type": "code",
Expand Down Expand Up @@ -115,8 +115,8 @@
"from azure.core.credentials import AzureKeyCredential\n",
"from azure.ai.formrecognizer import DocumentAnalysisClient\n",
"\n",
"endpoint = os.environ[\"AZURE_FORM_RECOGNIZER_ENDPOINT\"]\n",
"key = os.environ[\"AZURE_FORM_RECOGNIZER_KEY\"]\n",
"endpoint = os.environ[\"AZURE_DOC_INTELLIGENCE_ENDPOINT\"]\n",
"key = os.environ[\"AZURE_DOC_INTELLIGENCE_KEY\"]\n",
"\n",
"document_analysis_client = DocumentAnalysisClient(\n",
" endpoint=endpoint, credential=AzureKeyCredential(key)\n",
Expand Down Expand Up @@ -259,8 +259,8 @@
"outputs": [],
"source": [
"# Create an SDK client\n",
"service_endpoint = os.getenv(\"AZURE_COGNITIVE_SEARCH_ENDPOINT\") \n",
"key = os.getenv(\"AZURE_COGNITIVE_SEARCH_KEY\")\n",
"service_endpoint = os.getenv(\"AZURE_AI_SEARCH_ENDPOINT\") \n",
"key = os.getenv(\"AZURE_AI_SEARCH_KEY\")\n",
"credential = AzureKeyCredential(key)\n",
"\n",
"index_name = \"research-paper-index\"\n",
Expand Down