Skip to content

Commit 6e59e7f

Browse files
author
Garo Yeriazarian
committed
Initial commit
0 parents  commit 6e59e7f

File tree

148 files changed

+40955
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

148 files changed

+40955
-0
lines changed

.azdo/pipelines/azure-dev.yml

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
# Run when commits are pushed to mainline branch (main or master)
2+
# Set this to the mainline branch you are using
3+
trigger:
4+
- main
5+
- master
6+
7+
# Azure Pipelines workflow to deploy to Azure using azd
8+
# To configure required secrets and service connection for connecting to Azure, simply run `azd pipeline config --provider azdo`
9+
# Task "Install azd" needs to install setup-azd extension for azdo - https://marketplace.visualstudio.com/items?itemName=ms-azuretools.azd
10+
# See below for alternative task to install azd if you can't install above task in your organization
11+
12+
pool:
13+
vmImage: ubuntu-latest
14+
15+
steps:
16+
- task: setup-azd@0
17+
displayName: Install azd
18+
19+
# If you can't install above task in your organization, you can comment it and uncomment below task to install azd
20+
# - task: Bash@3
21+
# displayName: Install azd
22+
# inputs:
23+
# targetType: 'inline'
24+
# script: |
25+
# curl -fsSL https://aka.ms/install-azd.sh | bash
26+
27+
# azd delegate auth to az to use service connection with AzureCLI@2
28+
- pwsh: |
29+
azd config set auth.useAzCliAuth "true"
30+
displayName: Configure AZD to Use AZ CLI Authentication.
31+
32+
- task: AzureCLI@2
33+
displayName: Provision Infrastructure
34+
inputs:
35+
azureSubscription: azconnection
36+
scriptType: bash
37+
scriptLocation: inlineScript
38+
inlineScript: |
39+
azd provision --no-prompt
40+
env:
41+
AZURE_SUBSCRIPTION_ID: $(AZURE_SUBSCRIPTION_ID)
42+
AZURE_ENV_NAME: $(AZURE_ENV_NAME)
43+
AZURE_LOCATION: $(AZURE_LOCATION)
44+
AZD_INITIAL_ENVIRONMENT_CONFIG: $(secrets.AZD_INITIAL_ENVIRONMENT_CONFIG)
45+
46+
- task: AzureCLI@2
47+
displayName: Deploy Application
48+
inputs:
49+
azureSubscription: azconnection
50+
scriptType: bash
51+
scriptLocation: inlineScript
52+
inlineScript: |
53+
azd deploy --no-prompt
54+
env:
55+
AZURE_SUBSCRIPTION_ID: $(AZURE_SUBSCRIPTION_ID)
56+
AZURE_ENV_NAME: $(AZURE_ENV_NAME)
57+
AZURE_LOCATION: $(AZURE_LOCATION)

.devcontainer/devcontainer.json

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
{
2+
"name": "Azure Developer CLI",
3+
"image": "mcr.microsoft.com/devcontainers/dotnet:8.0-bookworm",
4+
"features": {
5+
"ghcr.io/devcontainers/features/docker-in-docker:2": {
6+
},
7+
"ghcr.io/devcontainers/features/node:1": {
8+
"version": "18",
9+
"nodeGypDependencies": false
10+
},
11+
"ghcr.io/azure/azure-dev/azd:latest": {}
12+
},
13+
"customizations": {
14+
"vscode": {
15+
"extensions": [
16+
"GitHub.vscode-github-actions",
17+
"ms-azuretools.azure-dev",
18+
"ms-azuretools.vscode-azurefunctions",
19+
"ms-azuretools.vscode-bicep",
20+
"ms-azuretools.vscode-docker",
21+
"ms-dotnettools.csharp",
22+
"ms-dotnettools.vscode-dotnet-runtime",
23+
"ms-vscode.vscode-node-azure-pack"
24+
]
25+
}
26+
},
27+
"forwardPorts": [
28+
3000,
29+
3100
30+
],
31+
"postCreateCommand": "",
32+
"remoteUser": "vscode",
33+
"hostRequirements": {
34+
"memory": "8gb"
35+
}
36+
}

.gitattributes

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
* text=auto eol=lf
2+
*.{cmd,[cC][mM][dD]} text eol=crlf
3+
*.{bat,[bB][aA][tT]} text eol=crlf

.github/workflows/azure-dev.yml

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
on:
2+
workflow_dispatch:
3+
push:
4+
# Run when commits are pushed to mainline branch (main or master)
5+
# Set this to the mainline branch you are using
6+
branches:
7+
- main
8+
- master
9+
10+
# GitHub Actions workflow to deploy to Azure using azd
11+
# To configure required secrets for connecting to Azure, simply run `azd pipeline config`
12+
13+
# Set up permissions for deploying with secretless Azure federated credentials
14+
# https://learn.microsoft.com/en-us/azure/developer/github/connect-from-azure?tabs=azure-portal%2Clinux#set-up-azure-login-with-openid-connect-authentication
15+
permissions:
16+
id-token: write
17+
contents: read
18+
19+
jobs:
20+
build:
21+
runs-on: ubuntu-latest
22+
env:
23+
AZURE_CLIENT_ID: ${{ vars.AZURE_CLIENT_ID }}
24+
AZURE_TENANT_ID: ${{ vars.AZURE_TENANT_ID }}
25+
AZURE_SUBSCRIPTION_ID: ${{ vars.AZURE_SUBSCRIPTION_ID }}
26+
AZURE_ENV_NAME: ${{ vars.AZURE_ENV_NAME }}
27+
AZURE_LOCATION: ${{ vars.AZURE_LOCATION }}
28+
steps:
29+
- name: Checkout
30+
uses: actions/checkout@v4
31+
32+
- name: Install azd
33+
uses: Azure/setup-azd@v2
34+
35+
- name: Log in with Azure (Federated Credentials)
36+
if: ${{ env.AZURE_CLIENT_ID != '' }}
37+
run: |
38+
azd auth login `
39+
--client-id "$Env:AZURE_CLIENT_ID" `
40+
--federated-credential-provider "github" `
41+
--tenant-id "$Env:AZURE_TENANT_ID"
42+
shell: pwsh
43+
44+
- name: Log in with Azure (Client Credentials)
45+
if: ${{ env.AZURE_CREDENTIALS != '' }}
46+
run: |
47+
$info = $Env:AZURE_CREDENTIALS | ConvertFrom-Json -AsHashtable;
48+
Write-Host "::add-mask::$($info.clientSecret)"
49+
50+
azd auth login `
51+
--client-id "$($info.clientId)" `
52+
--client-secret "$($info.clientSecret)" `
53+
--tenant-id "$($info.tenantId)"
54+
shell: pwsh
55+
env:
56+
AZURE_CREDENTIALS: ${{ secrets.AZURE_CREDENTIALS }}
57+
58+
- name: Provision Infrastructure
59+
run: azd provision --no-prompt
60+
env:
61+
AZD_INITIAL_ENVIRONMENT_CONFIG: ${{ secrets.AZD_INITIAL_ENVIRONMENT_CONFIG }}
62+
63+
- name: Deploy Application
64+
run: azd deploy --no-prompt

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
.azure

.vscode/extensions.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"recommendations": [
3+
"ms-azuretools.azure-dev"
4+
]
5+
}

.vscode/launch.json

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
{
2+
"version": "0.2.0",
3+
"configurations": [
4+
{
5+
"name": "Debug Web",
6+
"request": "launch",
7+
"type": "msedge",
8+
"webRoot": "${workspaceFolder}/src/web/src",
9+
"url": "http://localhost:3000",
10+
"sourceMapPathOverrides": {
11+
"webpack:///src/*": "${webRoot}/*"
12+
},
13+
},
14+
15+
{
16+
// Use IntelliSense to find out which attributes exist for C# debugging
17+
// Use hover for the description of the existing attributes
18+
// For further information visit https://github.com/OmniSharp/omnisharp-vscode/blob/master/debugger-launchjson.md
19+
"name": "Debug API",
20+
"type": "coreclr",
21+
"request": "launch",
22+
"preLaunchTask": "Build API",
23+
// If you have changed target frameworks, make sure to update the program path.
24+
"program": "${workspaceFolder}/src/api/bin/Debug/net8.0/Todo.Api.dll",
25+
"args": [],
26+
"cwd": "${workspaceFolder}/src/api",
27+
"stopAtEntry": false,
28+
"env": {
29+
"ASPNETCORE_ENVIRONMENT": "Development"
30+
},
31+
"envFile": "${input:dotEnvFilePath}"
32+
},
33+
34+
{
35+
"name": ".NET Core Attach",
36+
"type": "coreclr",
37+
"request": "attach"
38+
}
39+
],
40+
41+
"inputs": [
42+
{
43+
"id": "dotEnvFilePath",
44+
"type": "command",
45+
"command": "azure-dev.commands.getDotEnvFilePath"
46+
}
47+
]
48+
}

.vscode/tasks.json

Lines changed: 101 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
1+
{
2+
"version": "2.0.0",
3+
"tasks": [
4+
{
5+
"label": "Start API",
6+
"type": "dotenv",
7+
"targetTasks": "API dotnet run",
8+
"file": "${input:dotEnvFilePath}"
9+
},
10+
{
11+
"label": "API dotnet run",
12+
"detail": "Helper task--use 'Start API' task to ensure environment is set up correctly",
13+
"type": "shell",
14+
"command": "dotnet run",
15+
"options": {
16+
"cwd": "${workspaceFolder}/src/api/"
17+
},
18+
"presentation": {
19+
"panel": "dedicated",
20+
},
21+
"problemMatcher": []
22+
},
23+
{
24+
"label": "Build API",
25+
"command": "dotnet",
26+
"type": "process",
27+
"args": [
28+
"build",
29+
"${workspaceFolder}/src/api/Todo.Api.csproj",
30+
"/property:GenerateFullPaths=true",
31+
"/consoleloggerparameters:NoSummary"
32+
],
33+
"problemMatcher": "$msCompile"
34+
},
35+
{
36+
"label": "Watch API",
37+
"command": "dotnet",
38+
"type": "process",
39+
"args": [
40+
"watch",
41+
"run",
42+
"--project",
43+
"${workspaceFolder}/src/api/Todo.Api.csproj"
44+
],
45+
"problemMatcher": "$msCompile"
46+
},
47+
48+
{
49+
"label": "Start Web",
50+
"type": "dotenv",
51+
"targetTasks": [
52+
"Restore Web",
53+
"Web npm start"
54+
],
55+
"file": "${input:dotEnvFilePath}"
56+
},
57+
{
58+
"label": "Restore Web",
59+
"type": "shell",
60+
"command": "azd restore web",
61+
"presentation": {
62+
"reveal": "silent"
63+
},
64+
"problemMatcher": []
65+
},
66+
{
67+
"label": "Web npm start",
68+
"detail": "Helper task--use 'Start Web' task to ensure environment is set up correctly",
69+
"type": "shell",
70+
"command": "npx -y cross-env VITE_APPLICATIONINSIGHTS_CONNECTION_STRING=\"$APPLICATIONINSIGHTS_CONNECTION_STRING\" npm run dev",
71+
"options": {
72+
"cwd": "${workspaceFolder}/src/web/",
73+
"env": {
74+
"VITE_API_BASE_URL": "http://localhost:3100",
75+
"BROWSER": "none"
76+
}
77+
},
78+
"presentation": {
79+
"panel": "dedicated",
80+
},
81+
"problemMatcher": []
82+
},
83+
84+
{
85+
"label": "Start API and Web",
86+
"dependsOn":[
87+
"Start API",
88+
"Start Web"
89+
],
90+
"problemMatcher": []
91+
}
92+
],
93+
94+
"inputs": [
95+
{
96+
"id": "dotEnvFilePath",
97+
"type": "command",
98+
"command": "azure-dev.commands.getDotEnvFilePath"
99+
}
100+
]
101+
}

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright 2022 (c) Microsoft Corporation.
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE

0 commit comments

Comments
 (0)