-
Notifications
You must be signed in to change notification settings - Fork 35
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update nodejs-typescript-food-catalog with Azure deployment workflow (#…
…64) * WIP * Add support for provisioning and deploying to Azure, and publishing to TAC * Add support for provisioning and deploying to Azure, and publishing to Teams Admin Center * Refactor env.js script * Update sample.json with new updateDateTime value * Update recommended extensions * Change app registration audience to single tenant * Update sample metadata and readme * Update entra app registration with multi tenant audience
- Loading branch information
1 parent
1126c42
commit e5b658b
Showing
15 changed files
with
1,833 additions
and
1,174 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,16 @@ | ||
*.js.map | ||
*.ts | ||
.git* | ||
_storage_emulator | ||
.tours | ||
.vscode | ||
appPackage | ||
assets | ||
env | ||
infra | ||
scripts | ||
*.ts | ||
*.js.map | ||
local.settings.json | ||
test | ||
getting_started.md | ||
node_modules/@types/ | ||
node_modules/azure-functions-core-tools/ | ||
node_modules/typescript/ | ||
readme.md | ||
teamsapp.local.yml | ||
teamsapp.yml | ||
tsconfig.json |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 3 additions & 1 deletion
4
samples/nodejs-typescript-food-catalog/.vscode/extensions.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,7 @@ | ||
{ | ||
"recommendations": [ | ||
"ms-azuretools.vscode-azurefunctions" | ||
"ms-azuretools.vscode-azurefunctions", | ||
"ms-azuretools.vscode-bicep", | ||
"TeamsDevApp.ms-teams-vscode-extension" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
123 changes: 119 additions & 4 deletions
123
samples/nodejs-typescript-food-catalog/infra/azure.bicep
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,132 @@ | ||
param resourceBaseName string | ||
param location string = resourceGroup().location | ||
|
||
resource storageAccount 'Microsoft.Storage/storageAccounts@2021-04-01' = { | ||
param appClientId string | ||
@secure() | ||
param appClientSecret string | ||
param appTenantId string | ||
|
||
// create storage account to store table data | ||
resource storageAccount 'Microsoft.Storage/storageAccounts@2022-05-01' = { | ||
name: resourceBaseName | ||
location: location | ||
kind: 'StorageV2' | ||
sku: { | ||
name: 'Standard_LRS' | ||
} | ||
kind: 'StorageV2' | ||
properties: { | ||
supportsHttpsTrafficOnly: true | ||
defaultToOAuthAuthentication: true | ||
} | ||
} | ||
|
||
// create app service plan for function app | ||
resource hostingPlan 'Microsoft.Web/serverfarms@2021-03-01' = { | ||
name: resourceBaseName | ||
location: location | ||
sku: { | ||
name: 'Y1' | ||
tier: 'Dynamic' | ||
} | ||
properties: {} | ||
} | ||
|
||
// create function app | ||
resource functionApp 'Microsoft.Web/sites@2021-03-01' = { | ||
name: resourceBaseName | ||
location: location | ||
kind: 'functionapp' | ||
identity: { | ||
type: 'SystemAssigned' | ||
} | ||
properties: { | ||
serverFarmId: hostingPlan.id | ||
siteConfig: { | ||
ftpsState: 'FtpsOnly' | ||
minTlsVersion: '1.2' | ||
} | ||
httpsOnly: true | ||
} | ||
} | ||
|
||
|
||
// create azure key vault | ||
resource keyVault 'Microsoft.KeyVault/vaults@2021-06-01-preview' = { | ||
name: resourceBaseName | ||
location: location | ||
properties: { | ||
sku: { | ||
family: 'A' | ||
name: 'standard' | ||
} | ||
tenantId: subscription().tenantId | ||
accessPolicies: [ | ||
{ | ||
tenantId: subscription().tenantId | ||
objectId: functionApp.identity.principalId | ||
permissions: { | ||
secrets: ['get', 'list'] | ||
} | ||
} | ||
] | ||
} | ||
} | ||
|
||
// add client secret to key vault | ||
resource appClientSecretVault 'Microsoft.KeyVault/vaults/secrets@2021-06-01-preview' = { | ||
parent: keyVault | ||
name: 'clientSecret' | ||
properties: { | ||
value: appClientSecret | ||
} | ||
} | ||
|
||
// add storage account connection string to key vault | ||
resource storageAccountConnectionStringVault 'Microsoft.KeyVault/vaults/secrets@2021-06-01-preview' = { | ||
parent: keyVault | ||
name: 'storageAccountConnectionString' | ||
properties: { | ||
value: storageAccountConnectionString | ||
} | ||
} | ||
|
||
// set app settings on the function app | ||
resource siteConfig 'Microsoft.Web/sites/config@2021-02-01' = { | ||
name: 'appsettings' | ||
parent: functionApp | ||
properties: { | ||
AzureWebJobsStorage: '@Microsoft.KeyVault(VaultName=${keyVault.name};SecretName=storageAccountConnectionString)' | ||
WEBSITE_CONTENTAZUREFILECONNECTIONSTRING: '@Microsoft.KeyVault(VaultName=${keyVault.name};SecretName=storageAccountConnectionString)' | ||
WEBSITE_CONTENTSHARE: toLower(resourceBaseName) | ||
FUNCTIONS_EXTENSION_VERSION: '~4' | ||
WEBSITE_NODE_DEFAULT_VERSION: '~18' | ||
APPINSIGHTS_INSTRUMENTATIONKEY: applicationInsights.properties.InstrumentationKey | ||
FUNCTIONS_WORKER_RUNTIME: 'node' | ||
WEBSITE_RUN_FROM_PACKAGE: '1' | ||
ENTRA_APP_CLIENT_ID: appClientId | ||
ENTRA_APP_CLIENT_SECRET: '@Microsoft.KeyVault(VaultName=${keyVault.name};SecretName=clientSecret)' | ||
ENTRA_APP_TENANT_ID: appTenantId | ||
NOTIFICATION_ENDPOINT: notificationEndpoint | ||
GRAPH_SCHEMA_STATUS_INTERVAL: '10' | ||
} | ||
} | ||
|
||
// create application insights resource | ||
resource applicationInsights 'Microsoft.Insights/components@2020-02-02' = { | ||
name: resourceBaseName | ||
location: location | ||
kind: 'web' | ||
properties: { | ||
Application_Type: 'web' | ||
Request_Source: 'rest' | ||
} | ||
} | ||
|
||
// create a storage account connection string | ||
var storageAccountConnectionString = 'DefaultEndpointsProtocol=https;AccountName=${storageAccount.name};EndpointSuffix=${environment().suffixes.storage};AccountKey=${storageAccount.listKeys().keys[0].value}' | ||
var notificationEndpoint = 'https://${functionApp.properties.defaultHostName}' | ||
|
||
// write the storage account connection string to environment file | ||
// output values to env.dev so they can be used by other actions | ||
output NOTIFICATION_FUNCTION_RESOURCE_ID string = functionApp.id | ||
output SECRET_STORAGE_ACCOUNT_CONNECTION_STRING string = storageAccountConnectionString | ||
output NOTIFICATION_ENDPOINT string = notificationEndpoint | ||
output NOTIFICATION_DOMAIN string = functionApp.properties.defaultHostName |
23 changes: 16 additions & 7 deletions
23
samples/nodejs-typescript-food-catalog/infra/azure.parameters.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,18 @@ | ||
{ | ||
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentParameters.json#", | ||
"contentVersion": "1.0.0.0", | ||
"parameters": { | ||
"resourceBaseName": { | ||
"value": "connector${{RESOURCE_SUFFIX}}" | ||
} | ||
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentParameters.json#", | ||
"contentVersion": "1.0.0.0", | ||
"parameters": { | ||
"resourceBaseName": { | ||
"value": "connector${{RESOURCE_SUFFIX}}" | ||
}, | ||
"appClientId": { | ||
"value": "${{ENTRA_APP_CLIENT_ID}}" | ||
}, | ||
"appClientSecret": { | ||
"value": "${{SECRET_ENTRA_APP_CLIENT_SECRET}}" | ||
}, | ||
"appTenantId": { | ||
"value": "${{ENTRA_APP_TENANT_ID}}" | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.