Skip to content

Commit

Permalink
Synchronize repo from Repoman
Browse files Browse the repository at this point in the history
  • Loading branch information
azure-sdk committed Dec 20, 2023
1 parent 5fb3911 commit 33ff227
Show file tree
Hide file tree
Showing 18 changed files with 698 additions and 275 deletions.
43 changes: 28 additions & 15 deletions .azdo/pipelines/azure-dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,9 @@ trigger:
- master

# Azure Pipelines workflow to deploy to Azure using azd
# To configure required secrets for connecting to Azure, simply run `azd pipeline config --provider azdo`
# To configure required secrets and service connection for connecting to Azure, simply run `azd pipeline config --provider azdo`
# Task "Install azd" needs to install setup-azd extension for azdo - https://marketplace.visualstudio.com/items?itemName=ms-azuretools.azd
# See below for alternative task to install azd if you can't install above task in your organization

pool:
vmImage: ubuntu-latest
Expand All @@ -15,29 +16,41 @@ steps:
- task: setup-azd@0
displayName: Install azd

- pwsh: |
$info = $Env:AZURE_CREDENTIALS | ConvertFrom-Json -AsHashtable;
azd auth login `
--client-id "$($info.clientId)" `
--client-secret "$($info.clientSecret)" `
--tenant-id "$($info.tenantId)"
displayName: azd login
env:
AZURE_CREDENTIALS: $(AZURE_CREDENTIALS)
# If you can't install above task in your organization, you can comment it and uncomment below task to install azd
# - task: Bash@3
# displayName: Install azd
# inputs:
# targetType: 'inline'
# script: |
# curl -fsSL https://aka.ms/install-azd.sh | bash

# azd delegate auth to az to use service connection with AzureCLI@2
- pwsh: |
azd provision --no-prompt
azd config set auth.useAzCliAuth "true"
displayName: Configure AZD to Use AZ CLI Authentication.
- task: AzureCLI@2
displayName: Provision Infrastructure
inputs:
azureSubscription: azconnection
scriptType: bash
scriptLocation: inlineScript
inlineScript: |
azd provision --no-prompt
env:
AZURE_SUBSCRIPTION_ID: $(AZURE_SUBSCRIPTION_ID)
AZURE_ENV_NAME: $(AZURE_ENV_NAME)
AZURE_LOCATION: $(AZURE_LOCATION)

- pwsh: |
azd deploy --no-prompt
- task: AzureCLI@2
displayName: Deploy Application
inputs:
azureSubscription: azconnection
scriptType: bash
scriptLocation: inlineScript
inlineScript: |
azd deploy --no-prompt
env:
AZURE_SUBSCRIPTION_ID: $(AZURE_SUBSCRIPTION_ID)
AZURE_ENV_NAME: $(AZURE_ENV_NAME)
AZURE_LOCATION: $(AZURE_LOCATION)
AZURE_LOCATION: $(AZURE_LOCATION)
33 changes: 20 additions & 13 deletions .azdo/pipelines/terraform/java/azure-dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,9 @@ trigger:
- master

# Azure Pipelines workflow to deploy to Azure using azd
# To configure required secrets for connecting to Azure, simply run `azd pipeline config --provider azdo`
# To configure required secrets and service connection for connecting to Azure, simply run `azd pipeline config --provider azdo`
# Task "Install azd" needs to install setup-azd extension for azdo - https://marketplace.visualstudio.com/items?itemName=ms-azuretools.azd
# See below for alternative task to install azd if you can't install above task in your organization

pool:
vmImage: ubuntu-latest
Expand All @@ -15,16 +16,18 @@ steps:
- task: setup-azd@0
displayName: Install azd

# If you can't install above task in your organization, you can comment it and uncomment below task to install azd
# - task: Bash@3
# displayName: Install azd
# inputs:
# targetType: 'inline'
# script: |
# curl -fsSL https://aka.ms/install-azd.sh | bash

# azd delegate auth to az to use service connection with AzureCLI@2
- pwsh: |
$info = $Env:AZURE_CREDENTIALS | ConvertFrom-Json -AsHashtable;
azd auth login `
--client-id "$($info.clientId)" `
--client-secret "$($info.clientSecret)" `
--tenant-id "$($info.tenantId)"
displayName: azd login
env:
AZURE_CREDENTIALS: $(AZURE_CREDENTIALS)
azd config set auth.useAzCliAuth "true"
displayName: Configure AZD to Use AZ CLI Authentication.
- task: JavaToolInstaller@0
inputs:
Expand All @@ -51,11 +54,15 @@ steps:
RS_STORAGE_ACCOUNT: $(RS_STORAGE_ACCOUNT)
RS_CONTAINER_NAME: $(RS_CONTAINER_NAME)

- pwsh: |
azd deploy --no-prompt
- task: AzureCLI@2
displayName: Deploy Application
inputs:
azureSubscription: azconnection
scriptType: bash
scriptLocation: inlineScript
inlineScript: |
azd deploy --no-prompt
env:
AZURE_SUBSCRIPTION_ID: $(AZURE_SUBSCRIPTION_ID)
AZURE_ENV_NAME: $(AZURE_ENV_NAME)
AZURE_LOCATION: $(AZURE_LOCATION)
2 changes: 1 addition & 1 deletion .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "Azure Developer CLI",
"image": "mcr.microsoft.com/devcontainers/dotnet:6.0-bullseye",
"image": "mcr.microsoft.com/devcontainers/dotnet:8.0-bookworm",
"features": {
"ghcr.io/devcontainers/features/docker-in-docker:2": {
},
Expand Down
4 changes: 2 additions & 2 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"url": "http://localhost:3000",
"sourceMapPathOverrides": {
"webpack:///src/*": "${webRoot}/*"
},
},
},

{
Expand All @@ -21,7 +21,7 @@
"request": "launch",
"preLaunchTask": "Build API",
// If you have changed target frameworks, make sure to update the program path.
"program": "${workspaceFolder}/src/api/bin/Debug/net6.0/Todo.Api.dll",
"program": "${workspaceFolder}/src/api/bin/Debug/net8.0/Todo.Api.dll",
"args": [],
"cwd": "${workspaceFolder}/src/api",
"stopAtEntry": false,
Expand Down
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ Let's jump in and get this up and running in Azure. When you are finished, you w
The following prerequisites are required to use this application. Please ensure that you have them all installed locally.

- [Azure Developer CLI](https://aka.ms/azd-install)
- [.NET SDK 6.0](https://dotnet.microsoft.com/download/dotnet/6.0) - for the API backend
- [.NET SDK 8.0](https://dotnet.microsoft.com/download/dotnet/8.0) - for the API backend
- [Node.js with npm (18.17.1+)](https://nodejs.org/) - for the Web frontend

### Quickstart
Expand All @@ -52,7 +52,7 @@ This quickstart will show you how to authenticate on Azure, initialize using a t
# Log in to azd. Only required once per-install.
azd auth login

# First-time project setup. Initialize a project in the current directory, using this template.
# First-time project setup. Initialize a project in the current directory, using this template.
azd init --template Azure-Samples/todo-csharp-cosmos-sql

# Provision and deploy to Azure
Expand Down Expand Up @@ -85,13 +85,13 @@ At this point, you have a complete application deployed on Azure. But there is m

> Note: Needs to manually install [setup-azd extension](https://marketplace.visualstudio.com/items?itemName=ms-azuretools.azd) for Azure DevOps (azdo).
- [`azd pipeline config`](https://learn.microsoft.com/azure/developer/azure-developer-cli/configure-devops-pipeline?tabs=GitHub) - to configure a CI/CD pipeline (using GitHub Actions or Azure DevOps) to deploy your application whenever code is pushed to the main branch.
- [`azd pipeline config`](https://learn.microsoft.com/azure/developer/azure-developer-cli/configure-devops-pipeline?tabs=GitHub) - to configure a CI/CD pipeline (using GitHub Actions or Azure DevOps) to deploy your application whenever code is pushed to the main branch.

- [`azd monitor`](https://learn.microsoft.com/azure/developer/azure-developer-cli/monitor-your-app) - to monitor the application and quickly navigate to the various Application Insights dashboards (e.g. overview, live metrics, logs)

- [Run and Debug Locally](https://learn.microsoft.com/azure/developer/azure-developer-cli/debug?pivots=ide-vs-code) - using Visual Studio Code and the Azure Developer CLI extension

- [`azd down`](https://learn.microsoft.com/azure/developer/azure-developer-cli/reference#azd-down) - to delete all the Azure resources created with this template
- [`azd down`](https://learn.microsoft.com/azure/developer/azure-developer-cli/reference#azd-down) - to delete all the Azure resources created with this template

- [Enable optional features, like APIM](./OPTIONAL_FEATURES.md) - for enhanced backend API protection and observability

Expand Down
2 changes: 1 addition & 1 deletion infra/app/api.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ module api '../core/host/appservice.bicep' = {
appSettings: appSettings
keyVaultName: keyVaultName
runtimeName: 'dotnetcore'
runtimeVersion: '6.0'
runtimeVersion: '8.0'
scmDoBuildDuringDeployment: false
}
}
Expand Down
11 changes: 11 additions & 0 deletions infra/core/ai/cognitiveservices.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,21 @@ param tags object = {}
param customSubDomainName string = name
param deployments array = []
param kind string = 'OpenAI'

@allowed([ 'Enabled', 'Disabled' ])
param publicNetworkAccess string = 'Enabled'
param sku object = {
name: 'S0'
}

param allowedIpRules array = []
param networkAcls object = empty(allowedIpRules) ? {
defaultAction: 'Allow'
} : {
ipRules: allowedIpRules
defaultAction: 'Deny'
}

resource account 'Microsoft.CognitiveServices/accounts@2023-05-01' = {
name: name
location: location
Expand All @@ -19,6 +29,7 @@ resource account 'Microsoft.CognitiveServices/accounts@2023-05-01' = {
properties: {
customSubDomainName: customSubDomainName
publicNetworkAccess: publicNetworkAccess
networkAcls: networkAcls
}
sku: sku
}
Expand Down
2 changes: 1 addition & 1 deletion infra/core/database/sqlserver/sqlserver.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ wget https://github.com/microsoft/go-sqlcmd/releases/download/v0.8.1/sqlcmd-v0.8
tar x -f sqlcmd-v0.8.1-linux-x64.tar.bz2 -C .
cat <<SCRIPT_END > ./initDb.sql
drop user ${APPUSERNAME}
drop user if exists ${APPUSERNAME}
go
create user ${APPUSERNAME} with password = '${APPUSERPASSWORD}'
go
Expand Down
27 changes: 16 additions & 11 deletions infra/core/host/appservice.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -65,16 +65,6 @@ resource appService 'Microsoft.Web/sites@2022-03-01' = {

identity: { type: managedIdentity ? 'SystemAssigned' : 'None' }

resource configLogs 'config' = {
name: 'logs'
properties: {
applicationLogs: { fileSystem: { level: 'Verbose' } }
detailedErrorMessages: { enabled: true }
failedRequestsTracing: { enabled: true }
httpLogs: { fileSystem: { enabled: true, retentionInDays: 1, retentionInMb: 35 } }
}
}

resource basicPublishingCredentialsPoliciesFtp 'basicPublishingCredentialsPolicies' = {
name: 'ftp'
properties: {
Expand All @@ -90,7 +80,9 @@ resource appService 'Microsoft.Web/sites@2022-03-01' = {
}
}

module config 'appservice-appsettings.bicep' = if (!empty(appSettings)) {
// Updates to the single Microsoft.sites/web/config resources that need to be performed sequentially
// sites/web/config 'appsettings'
module configAppSettings 'appservice-appsettings.bicep' = {
name: '${name}-appSettings'
params: {
name: appService.name
Expand All @@ -105,6 +97,19 @@ module config 'appservice-appsettings.bicep' = if (!empty(appSettings)) {
}
}

// sites/web/config 'logs'
resource configLogs 'Microsoft.Web/sites/config@2022-03-01' = {
name: 'logs'
parent: appService
properties: {
applicationLogs: { fileSystem: { level: 'Verbose' } }
detailedErrorMessages: { enabled: true }
failedRequestsTracing: { enabled: true }
httpLogs: { fileSystem: { enabled: true, retentionInDays: 1, retentionInMb: 35 } }
}
dependsOn: [configAppSettings]
}

resource keyVault 'Microsoft.KeyVault/vaults@2022-07-01' existing = if (!(empty(keyVaultName))) {
name: keyVaultName
}
Expand Down
5 changes: 2 additions & 3 deletions infra/core/monitor/applicationinsights.bicep
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
metadata description = 'Creates an Application Insights instance based on an existing Log Analytics workspace.'
param name string
param dashboardName string
param dashboardName string = ''
param location string = resourceGroup().location
param tags object = {}
param includeDashboard bool = true
param logAnalyticsWorkspaceId string

resource applicationInsights 'Microsoft.Insights/components@2020-02-02' = {
Expand All @@ -17,7 +16,7 @@ resource applicationInsights 'Microsoft.Insights/components@2020-02-02' = {
}
}

module applicationInsightsDashboard 'applicationinsights-dashboard.bicep' = if (includeDashboard) {
module applicationInsightsDashboard 'applicationinsights-dashboard.bicep' = if (!empty(dashboardName)) {
name: 'application-insights-dashboard'
params: {
name: dashboardName
Expand Down
4 changes: 1 addition & 3 deletions infra/core/monitor/monitoring.bicep
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
metadata description = 'Creates an Application Insights instance and a Log Analytics workspace.'
param logAnalyticsName string
param applicationInsightsName string
param applicationInsightsDashboardName string
param applicationInsightsDashboardName string = ''
param location string = resourceGroup().location
param tags object = {}
param includeDashboard bool = true

module logAnalytics 'loganalytics.bicep' = {
name: 'loganalytics'
Expand All @@ -22,7 +21,6 @@ module applicationInsights 'applicationinsights.bicep' = {
location: location
tags: tags
dashboardName: applicationInsightsDashboardName
includeDashboard: includeDashboard
logAnalyticsWorkspaceId: logAnalytics.outputs.id
}
}
Expand Down
Loading

0 comments on commit 33ff227

Please sign in to comment.