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
37 changes: 37 additions & 0 deletions .github/workflows/azureprojectgenerator.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: Build and deploy .NET Core application to Function App azureprojectgenerator
on:
push:
branches:
- generatesmallerprojects
env:
AZURE_FUNCTIONAPP_NAME: azureprojectgenerator
AZURE_FUNCTIONAPP_PACKAGE_PATH: azure-project-generator
DOTNET_VERSION: 8.0.x

jobs:
build-and-deploy:
runs-on: ubuntu-latest # For Linux, use ubuntu-latest
environment: dev
steps:
- name: 'Checkout GitHub Action'
uses: actions/checkout@v3

- name: Setup DotNet ${{ env.DOTNET_VERSION }} Environment
uses: actions/setup-dotnet@v3
with:
dotnet-version: ${{ env.DOTNET_VERSION }}

- name: 'Resolve Project Dependencies Using Dotnet'
shell: pwsh # For Linux, use bash
run: |
pushd './${{ env.AZURE_FUNCTIONAPP_PACKAGE_PATH }}'
dotnet build --configuration Release --output ./output
popd

- name: 'Run Azure Functions Action'
uses: Azure/functions-action@v1
id: fa
with:
app-name: ${{ env.AZURE_FUNCTIONAPP_NAME }}
package: '${{ env.AZURE_FUNCTIONAPP_PACKAGE_PATH }}/output'
publish-profile: ${{ secrets.AZURE_FUNCTIONAPP_PUBLISH_PROFILE }}
2 changes: 1 addition & 1 deletion azure-project-generator/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
using Microsoft.Extensions.Hosting;

var host = new HostBuilder()
.ConfigureFunctionsWorkerDefaults()
.ConfigureFunctionsWebApplication()
.ConfigureServices((context, services) =>
{
services.AddApplicationInsightsTelemetryWorkerService();
Expand All @@ -17,11 +17,11 @@
var config = context.Configuration;

// Initialize Azure OpenAI client
string keyFromEnvironment = config["AZURE_OPENAI_API_KEY"];

Check warning on line 20 in azure-project-generator/Program.cs

View workflow job for this annotation

GitHub Actions / build-and-deploy

Converting null literal or possible null value to non-nullable type.
string endpointFromEnvironment = config["AZURE_OPENAI_API_ENDPOINT"];

Check warning on line 21 in azure-project-generator/Program.cs

View workflow job for this annotation

GitHub Actions / build-and-deploy

Converting null literal or possible null value to non-nullable type.
string embeddingsDeployment = config["EMBEDDINGS_DEPLOYMENT"];

Check warning on line 22 in azure-project-generator/Program.cs

View workflow job for this annotation

GitHub Actions / build-and-deploy

Converting null literal or possible null value to non-nullable type.
string azureWebJobsStorage = config["AzureWebJobsStorage"];

Check warning on line 23 in azure-project-generator/Program.cs

View workflow job for this annotation

GitHub Actions / build-and-deploy

Converting null literal or possible null value to non-nullable type.
string completionsDeployment = config["COMPLETIONS_DEPLOYMENT"];

Check warning on line 24 in azure-project-generator/Program.cs

View workflow job for this annotation

GitHub Actions / build-and-deploy

Converting null literal or possible null value to non-nullable type.

if (string.IsNullOrEmpty(keyFromEnvironment) || string.IsNullOrEmpty(endpointFromEnvironment) || string.IsNullOrEmpty(embeddingsDeployment))
{
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
{
"$schema": "https://schema.management.azure.com/schemas/2018-05-01/subscriptionDeploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"resourceGroupName": {
"type": "string",
"defaultValue": "azureprojectgenerator-rg",
"metadata": {
"_parameterType": "resourceGroup",
"description": "Name of the resource group for the resource. It is recommended to put resources under same resource group for better tracking."
}
},
"resourceGroupLocation": {
"type": "string",
"defaultValue": "eastus",
"metadata": {
"_parameterType": "location",
"description": "Location of the resource group. Resource groups could have different location than resources."
}
},
"resourceLocation": {
"type": "string",
"defaultValue": "[parameters('resourceGroupLocation')]",
"metadata": {
"_parameterType": "location",
"description": "Location of the resource. By default use resource group's location, unless the resource provider is not supported there."
}
}
},
"resources": [
{
"type": "Microsoft.Resources/resourceGroups",
"name": "[parameters('resourceGroupName')]",
"location": "[parameters('resourceGroupLocation')]",
"apiVersion": "2019-10-01"
},
{
"type": "Microsoft.Resources/deployments",
"name": "[concat(parameters('resourceGroupName'), 'Deployment', uniqueString(concat('azure-project-generator', subscription().subscriptionId)))]",
"resourceGroup": "[parameters('resourceGroupName')]",
"apiVersion": "2019-10-01",
"dependsOn": [
"[parameters('resourceGroupName')]"
],
"properties": {
"mode": "Incremental",
"template": {
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"resources": [
{
"kind": "web",
"name": "azure-project-generator",
"type": "microsoft.insights/components",
"location": "[parameters('resourceLocation')]",
"properties": {},
"apiVersion": "2015-05-01"
}
]
}
}
}
],
"metadata": {
"_dependencyType": "appInsights.azure"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
{
"$schema": "https://schema.management.azure.com/schemas/2018-05-01/subscriptionDeploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"resourceGroupName": {
"type": "string",
"defaultValue": "azureprojectgenerator-rg",
"metadata": {
"_parameterType": "resourceGroup",
"description": "Name of the resource group for the resource. It is recommended to put resources under same resource group for better tracking."
}
},
"resourceGroupLocation": {
"type": "string",
"defaultValue": "eastus",
"metadata": {
"_parameterType": "location",
"description": "Location of the resource group. Resource groups could have different location than resources."
}
},
"resourceLocation": {
"type": "string",
"defaultValue": "[parameters('resourceGroupLocation')]",
"metadata": {
"_parameterType": "location",
"description": "Location of the resource. By default use resource group's location, unless the resource provider is not supported there."
}
}
},
"resources": [
{
"type": "Microsoft.Resources/resourceGroups",
"name": "[parameters('resourceGroupName')]",
"location": "[parameters('resourceGroupLocation')]",
"apiVersion": "2019-10-01"
},
{
"type": "Microsoft.Resources/deployments",
"name": "[concat(parameters('resourceGroupName'), 'Deployment', uniqueString(concat('azureprojectgenstor', subscription().subscriptionId)))]",
"resourceGroup": "[parameters('resourceGroupName')]",
"apiVersion": "2019-10-01",
"dependsOn": [
"[parameters('resourceGroupName')]"
],
"properties": {
"mode": "Incremental",
"template": {
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"resources": [
{
"sku": {
"name": "Standard_RAGRS",
"tier": "Standard"
},
"kind": "StorageV2",
"name": "azureprojectgenstor",
"type": "Microsoft.Storage/storageAccounts",
"location": "[parameters('resourceLocation')]",
"apiVersion": "2017-10-01"
}
]
}
}
}
],
"metadata": {
"_dependencyType": "storage.azure"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"dependencies": {
"appInsights1": {
"resourceId": "/subscriptions/[parameters('subscriptionId')]/resourceGroups/[parameters('resourceGroupName')]/providers/microsoft.insights/components/azure-project-generator",
"type": "appInsights.azure",
"connectionId": "APPLICATIONINSIGHTS_CONNECTION_STRING"
},
"storage1": {
"resourceId": "/subscriptions/[parameters('subscriptionId')]/resourceGroups/[parameters('resourceGroupName')]/providers/Microsoft.Storage/storageAccounts/azureprojectgenstor",
"type": "storage.azure",
"connectionId": "AzureWebJobsStorage"
}
}
}
15 changes: 8 additions & 7 deletions azure-project-generator/Properties/serviceDependencies.json
Original file line number Diff line number Diff line change
@@ -1,19 +1,20 @@
{
"dependencies": {
"appInsights1": {
"type": "appInsights"
},
"storage1": {
"type": "storage",
"connectionId": "AzureWebJobsStorage"
},
"secrets1": {
"type": "secrets"
},
"storage2": {
"type": "storage",
"connectionId": "azurestorage",
"dynamicId": null
},
"appInsights1": {
"type": "appInsights",
"connectionId": "APPLICATIONINSIGHTS_CONNECTION_STRING"
},
"storage1": {
"type": "storage",
"connectionId": "AzureWebJobsStorage"
}
}
}
2 changes: 1 addition & 1 deletion azure-project-generator/azure-project-generator.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
<PackageReference Include="Microsoft.Azure.Functions.Worker" Version="1.23.0" />
<PackageReference Include="Microsoft.Azure.Functions.Worker.Extensions.CosmosDB" Version="4.10.0" />
<PackageReference Include="Microsoft.Azure.Functions.Worker.Extensions.Http" Version="3.2.0" />
<PackageReference Include="Microsoft.Azure.Functions.Worker.Extensions.Http.AspNetCore" Version="1.2.1" />
<PackageReference Include="Microsoft.Azure.Functions.Worker.Extensions.Http.AspNetCore" Version="1.3.2" />
<PackageReference Include="Microsoft.Azure.Functions.Worker.Extensions.Storage.Blobs" Version="6.6.0" />
<PackageReference Include="Microsoft.Azure.Functions.Worker.Sdk" Version="1.17.4" />
<PackageReference Include="Microsoft.ApplicationInsights.WorkerService" Version="2.22.0" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ public ContentGenerationService(ILogger<ContentGenerationService> logger, Embedd
_logger = logger ?? throw new ArgumentNullException(nameof(logger));
_embeddingClient = embeddingClient ?? throw new ArgumentNullException(nameof(embeddingClient));
_completionsClient = completionsClient ?? throw new ArgumentNullException(nameof(completionsClient));

}

public string GenerateCertServiceContextSentence(CertificationService data) =>
Expand Down
Loading