Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -196,15 +196,15 @@ jobs:
# Increase the TPM for the Azure OpenAI models
echo "Increasing TPM for Azure OpenAI models..."
openai_gpt_deployment_url="/subscriptions/${{ secrets.AZURE_SUBSCRIPTION_ID }}/resourceGroups/${{ env.rg_name }}/providers/Microsoft.CognitiveServices/accounts/$openai_resource_name/deployments/gpt-4o-mini?api-version=2023-05-01"
az rest -m put -u "$openai_gpt_deployment_url" -b "{'sku':{'name':'Standard','capacity':${{ env.GPT_CAPACITY }}},'properties': {'model': {'format': 'OpenAI','name': 'gpt-4o-mini','version': '2024-07-18'}}}"
az rest -m put -u "$openai_gpt_deployment_url" -b "{'sku':{'name':'GlobalStandard','capacity':${{ env.GPT_CAPACITY }}},'properties': {'model': {'format': 'OpenAI','name': 'gpt-4o-mini','version': '2024-07-18'}}}"
if [ $? -ne 0 ]; then
echo "Failed to increase TPM for GPT deployment."
exit 1
else
echo "Successfully increased TPM for GPT deployment."
fi
openai_embedding_deployment_url="/subscriptions/${{ secrets.AZURE_SUBSCRIPTION_ID }}/resourceGroups/${{ env.rg_name }}/providers/Microsoft.CognitiveServices/accounts/$openai_resource_name/deployments/text-embedding-large?api-version=2023-05-01"
az rest -m put -u "$openai_embedding_deployment_url" -b "{'sku':{'name':'Standard','capacity': ${{ env.TEXT_EMBEDDING_CAPACITY }}},'properties': {'model': {'format': 'OpenAI','name': 'text-embedding-3-large','version': '1'}}}"
az rest -m put -u "$openai_embedding_deployment_url" -b "{'sku':{'name':'GlobalStandard','capacity': ${{ env.TEXT_EMBEDDING_CAPACITY }}},'properties': {'model': {'format': 'OpenAI','name': 'text-embedding-3-large','version': '1'}}}"
if [ $? -ne 0 ]; then
echo "Failed to increase TPM for Text Embedding deployment."
exit 1
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using Azure.Identity;
using Microsoft.Extensions.Azure;
using Microsoft.GS.DPSHost.AppConfiguration;
using Microsoft.GS.DPSHost.Helpers;

namespace Microsoft.GS.DPSHost.AppConfiguration
{
Expand All @@ -16,7 +17,7 @@ public static void Config(IHostApplicationBuilder builder)
//Read AppConfiguration with managed Identity
builder.Configuration.AddAzureAppConfiguration(options =>
{
options.Connect(new Uri(builder.Configuration["ConnectionStrings:AppConfig"]), new DefaultAzureCredential());
options.Connect(new Uri(builder.Configuration["ConnectionStrings:AppConfig"]), AzureCredentialHelper.GetAzureCredential());
});

//Read ServiceConfiguration
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
using System;
using System.Threading.Tasks;
using Azure.Core;
using Azure.Identity;

namespace Microsoft.GS.DPSHost.Helpers
{
/// <summary>
/// The Azure Credential Helper class
/// </summary>
public static class AzureCredentialHelper
{
/// <summary>
/// Get the Azure Credentials based on the environment type
/// </summary>
/// <param name="clientId">The client Id in case of User assigned Managed identity</param>
/// <returns>The Credential Object</returns>
public static TokenCredential GetAzureCredential(string? clientId = null)
{
var env = Environment.GetEnvironmentVariable("ASPNETCORE_ENVIRONMENT") ?? "Production";

if (string.Equals(env, "Development", StringComparison.OrdinalIgnoreCase))
{
return new DefaultAzureCredential(); // CodeQL [SM05139] Okay use of DefaultAzureCredential as it is only used in development
}
else
{
return clientId != null
? new ManagedIdentityCredential(clientId)
: new ManagedIdentityCredential();
}
}
}
}
2 changes: 1 addition & 1 deletion Deployment/bicep/azureopenaiservicemodel.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ resource gpt4Deployment 'Microsoft.CognitiveServices/accounts/deployments@2023-0
parent: openAIService
name: name
sku: {
name: 'Standard'
name: 'GlobalStandard'
capacity: model.capacity
}
properties: {
Expand Down
4 changes: 2 additions & 2 deletions Deployment/checkquota.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@ Write-Host "✅ Azure subscription set successfully."

# Define models and their minimum required capacities
$MIN_CAPACITY = @{
"OpenAI.Standard.gpt-4o-mini" = $GPT_MIN_CAPACITY
"OpenAI.Standard.text-embedding-3-large" = $TEXT_EMBEDDING_MIN_CAPACITY
"OpenAI.GlobalStandard.gpt-4o-mini" = $GPT_MIN_CAPACITY
"OpenAI.GlobalStandard.text-embedding-3-large" = $TEXT_EMBEDDING_MIN_CAPACITY
}

$VALID_REGION = ""
Expand Down
4 changes: 2 additions & 2 deletions Deployment/main.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ module gs_openaiservicemodels_gpt4o 'bicep/azureopenaiservicemodel.bicep' = {
version: '2024-07-18'
raiPolicyName: ''
capacity: 1
scaleType: 'Standard'
scaleType: 'GlobalStandard'
}

}
Expand All @@ -139,7 +139,7 @@ module gs_openaiservicemodels_text_embedding 'bicep/azureopenaiservicemodel.bice
version: '1'
raiPolicyName: ''
capacity: 1
scaleType: 'Standard'
scaleType: 'GlobalStandard'
}
}
dependsOn: [
Expand Down
4 changes: 2 additions & 2 deletions docs/QuotaCheck.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,9 +77,9 @@ The final table lists regions with available quota. You can select any of these
1. Open the terminal in VS Code or Codespaces.
2. If you're using VS Code, click the dropdown on the right side of the terminal window, and select `Git Bash`.
![git_bash](images/readme/git_bash.png)
3. Navigate to the `scripts` folder where the script files are located and make the script as executable:
3. Navigate to the `deployment` folder where the script files are located and make the script as executable:
```sh
cd infra/scripts
cd Deployment
chmod +x quota_check_params.sh
```
4. Run the appropriate script based on your requirement:
Expand Down
Loading