Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: simplify function creation #1295

Merged
merged 1 commit into from
Jul 15, 2024
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
23 changes: 0 additions & 23 deletions adaptive-card-notification/infra/azure.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,13 @@ param botAadAppClientId string
param botAadAppClientSecret string

param functionAppSKU string
param storageSKU string

@maxLength(42)
param botDisplayName string

param serverfarmsName string = resourceBaseName
param functionAppName string = resourceBaseName
param location string = resourceGroup().location
param storageName string = resourceBaseName

// Compute resources for your Web App
resource serverfarm 'Microsoft.Web/serverfarms@2021-02-01' = {
Expand All @@ -32,15 +30,6 @@ resource serverfarm 'Microsoft.Web/serverfarms@2021-02-01' = {
properties: {}
}

resource storage 'Microsoft.Storage/storageAccounts@2021-06-01' = {
name: storageName
kind: 'StorageV2'
location: location
sku: {
name: storageSKU // You can follow https://aka.ms/teamsfx-bicep-add-param-tutorial to add functionStorageSku property to provisionParameters to override the default value "Standard_LRS".
}
}

// Azure Function that host your app
resource functionApp 'Microsoft.Web/sites@2021-02-01' = {
kind: 'functionapp'
Expand All @@ -52,14 +41,6 @@ resource functionApp 'Microsoft.Web/sites@2021-02-01' = {
siteConfig: {
alwaysOn: true
appSettings: [
{
name: 'AzureWebJobsDashboard'
value: 'DefaultEndpointsProtocol=https;AccountName=${storage.name};AccountKey=${listKeys(storage.id, storage.apiVersion).keys[0].value};EndpointSuffix=${environment().suffixes.storage}' // Azure Functions internal setting
}
{
name: 'AzureWebJobsStorage'
value: 'DefaultEndpointsProtocol=https;AccountName=${storage.name};AccountKey=${listKeys(storage.id, storage.apiVersion).keys[0].value};EndpointSuffix=${environment().suffixes.storage}' // Azure Functions internal setting
}
{
name: 'FUNCTIONS_EXTENSION_VERSION'
value: '~4' // Use Azure Functions runtime v4
Expand All @@ -68,10 +49,6 @@ resource functionApp 'Microsoft.Web/sites@2021-02-01' = {
name: 'FUNCTIONS_WORKER_RUNTIME'
value: 'node' // Set runtime to NodeJS
}
{
name: 'WEBSITE_CONTENTAZUREFILECONNECTIONSTRING'
value: 'DefaultEndpointsProtocol=https;AccountName=${storage.name};AccountKey=${listKeys(storage.id, storage.apiVersion).keys[0].value};EndpointSuffix=${environment().suffixes.storage}' // Azure Functions internal setting
}
{
name: 'WEBSITE_RUN_FROM_PACKAGE'
value: '1' // Run Azure Functions from a package file
Expand Down
3 changes: 0 additions & 3 deletions adaptive-card-notification/infra/azure.parameters.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,6 @@
"functionAppSKU": {
"value": "B1"
},
"storageSKU": {
"value": "Standard_LRS"
},
"botDisplayName": {
"value": "adaptive-card-notifi"
}
Expand Down
24 changes: 0 additions & 24 deletions developer-assist-dashboard/infra/azure.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
@minLength(4)
param resourceBaseName string
param storageSku string
param functionStorageSKU string
param functionAppSKU string

param aadAppClientId string
Expand All @@ -15,7 +14,6 @@ param storageName string = resourceBaseName
param location string = resourceGroup().location
param serverfarmsName string = resourceBaseName
param functionAppName string = resourceBaseName
param functionStorageName string = '${resourceBaseName}api'
param teamsAppId string

param devopsOrgName string
Expand Down Expand Up @@ -82,14 +80,6 @@ resource functionApp 'Microsoft.Web/sites@2021-02-01' = {
allowedOrigins: [ tabEndpoint ]
}
appSettings: [
{
name: ' AzureWebJobsDashboard'
value: 'DefaultEndpointsProtocol=https;AccountName=${functionStorage.name};AccountKey=${listKeys(functionStorage.id, functionStorage.apiVersion).keys[0].value};EndpointSuffix=${environment().suffixes.storage}' // Azure Functions internal setting
}
{
name: 'AzureWebJobsStorage'
value: 'DefaultEndpointsProtocol=https;AccountName=${functionStorage.name};AccountKey=${listKeys(functionStorage.id, functionStorage.apiVersion).keys[0].value};EndpointSuffix=${environment().suffixes.storage}' // Azure Functions internal setting
}
{
name: 'FUNCTIONS_EXTENSION_VERSION'
value: '~4' // Use Azure Functions runtime v4
Expand All @@ -98,10 +88,6 @@ resource functionApp 'Microsoft.Web/sites@2021-02-01' = {
name: 'FUNCTIONS_WORKER_RUNTIME'
value: 'node' // Set runtime to NodeJS
}
{
name: 'WEBSITE_CONTENTAZUREFILECONNECTIONSTRING'
value: 'DefaultEndpointsProtocol=https;AccountName=${storage.name};AccountKey=${listKeys(storage.id, storage.apiVersion).keys[0].value};EndpointSuffix=${environment().suffixes.storage}' // Azure Functions internal setting
}
{
name: 'WEBSITE_RUN_FROM_PACKAGE'
value: '1' // Run Azure Functions from a package file
Expand Down Expand Up @@ -199,16 +185,6 @@ resource authSettings 'Microsoft.Web/sites/config@2021-02-01' = {
}
}

// Azure Storage is required when creating Azure Functions instance
resource functionStorage 'Microsoft.Storage/storageAccounts@2021-06-01' = {
name: functionStorageName
kind: 'StorageV2'
location: location
sku: {
name: functionStorageSKU// You can follow https://aka.ms/teamsfx-bicep-add-param-tutorial to add functionStorageSKUproperty to provisionParameters to override the default value "Standard_LRS".
}
}

// The output will be persisted in .env.{envName}. Visit https://aka.ms/teamsfx-actions/arm-deploy for more details.
output TAB_AZURE_STORAGE_RESOURCE_ID string = storage.id // used in deploy stage
output TAB_DOMAIN string = siteDomain
Expand Down
3 changes: 0 additions & 3 deletions developer-assist-dashboard/infra/azure.parameters.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,6 @@
"functionAppSKU": {
"value": "B1"
},
"functionStorageSKU": {
"value": "Standard_LRS"
},
"teamsAppId": {
"value": "${{TEAMS_APP_ID}}"
},
Expand Down
24 changes: 0 additions & 24 deletions graph-connector-app/infra/azure.bicep
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
param resourceBaseName string
param storageSKU string
param functionStorageSKU string
param functionAppSKU string

param aadAppClientId string
Expand All @@ -13,7 +12,6 @@ param storageName string = resourceBaseName
param location string = resourceGroup().location
param serverfarmsName string = resourceBaseName
param functionAppName string = resourceBaseName
param functionStorageName string = '${resourceBaseName}api'
var oauthAuthority = uri(aadAppOauthAuthorityHost, aadAppTenantId)

var teamsMobileOrDesktopAppClientId = '1fec8e78-bce4-4aaf-ab1b-5451cc387264'
Expand Down Expand Up @@ -66,14 +64,6 @@ resource functionApp 'Microsoft.Web/sites@2021-02-01' = {
allowedOrigins: [ tabEndpoint ]
}
appSettings: [
{
name: ' AzureWebJobsDashboard'
value: 'DefaultEndpointsProtocol=https;AccountName=${functionStorage.name};AccountKey=${listKeys(functionStorage.id, functionStorage.apiVersion).keys[0].value};EndpointSuffix=${environment().suffixes.storage}' // Azure Functions internal setting
}
{
name: 'AzureWebJobsStorage'
value: 'DefaultEndpointsProtocol=https;AccountName=${functionStorage.name};AccountKey=${listKeys(functionStorage.id, functionStorage.apiVersion).keys[0].value};EndpointSuffix=${environment().suffixes.storage}' // Azure Functions internal setting
}
{
name: 'FUNCTIONS_EXTENSION_VERSION'
value: '~4' // Use Azure Functions runtime v4
Expand All @@ -82,10 +72,6 @@ resource functionApp 'Microsoft.Web/sites@2021-02-01' = {
name: 'FUNCTIONS_WORKER_RUNTIME'
value: 'node' // Set runtime to NodeJS
}
{
name: 'WEBSITE_CONTENTAZUREFILECONNECTIONSTRING'
value: 'DefaultEndpointsProtocol=https;AccountName=${storage.name};AccountKey=${listKeys(storage.id, storage.apiVersion).keys[0].value};EndpointSuffix=${environment().suffixes.storage}' // Azure Functions internal setting
}
{
name: 'WEBSITE_RUN_FROM_PACKAGE'
value: '1' // Run Azure Functions from a package file
Expand Down Expand Up @@ -143,16 +129,6 @@ resource authSettings 'Microsoft.Web/sites/config@2021-02-01' = {
}
}

// Azure Storage is required when creating Azure Functions instance
resource functionStorage 'Microsoft.Storage/storageAccounts@2021-06-01' = {
name: functionStorageName
kind: 'StorageV2'
location: location
sku: {
name: functionStorageSKU
}
}

// The output will be persisted in .env.{envName}. Visit https://aka.ms/teamsfx-actions/arm-deploy for more details.
output TAB_AZURE_STORAGE_RESOURCE_ID string = storage.id // used in deploy stage
output TAB_DOMAIN string = siteDomain
Expand Down
3 changes: 0 additions & 3 deletions graph-connector-app/infra/azure.parameters.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,6 @@
},
"storageSKU": {
"value": "Standard_LRS"
},
"functionStorageSKU": {
"value": "Standard_LRS"
}
}
}
24 changes: 0 additions & 24 deletions hello-world-tab-with-backend/infra/azure.bicep
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
param resourceBaseName string
param storageSKU string
param functionStorageSKU string
param functionAppSKU string

param aadAppClientId string
Expand All @@ -13,7 +12,6 @@ param storageName string = resourceBaseName
param location string = resourceGroup().location
param serverfarmsName string = resourceBaseName
param functionAppName string = resourceBaseName
param functionStorageName string = '${resourceBaseName}api'
var oauthAuthority = uri(aadAppOauthAuthorityHost, aadAppTenantId)

var teamsMobileOrDesktopAppClientId = '1fec8e78-bce4-4aaf-ab1b-5451cc387264'
Expand Down Expand Up @@ -67,14 +65,6 @@ resource functionApp 'Microsoft.Web/sites@2021-02-01' = {
allowedOrigins: [ tabEndpoint ]
}
appSettings: [
{
name: ' AzureWebJobsDashboard'
value: 'DefaultEndpointsProtocol=https;AccountName=${functionStorage.name};AccountKey=${listKeys(functionStorage.id, functionStorage.apiVersion).keys[0].value};EndpointSuffix=${environment().suffixes.storage}' // Azure Functions internal setting
}
{
name: 'AzureWebJobsStorage'
value: 'DefaultEndpointsProtocol=https;AccountName=${functionStorage.name};AccountKey=${listKeys(functionStorage.id, functionStorage.apiVersion).keys[0].value};EndpointSuffix=${environment().suffixes.storage}' // Azure Functions internal setting
}
{
name: 'FUNCTIONS_EXTENSION_VERSION'
value: '~4' // Use Azure Functions runtime v4
Expand All @@ -83,10 +73,6 @@ resource functionApp 'Microsoft.Web/sites@2021-02-01' = {
name: 'FUNCTIONS_WORKER_RUNTIME'
value: 'node' // Set runtime to NodeJS
}
{
name: 'WEBSITE_CONTENTAZUREFILECONNECTIONSTRING'
value: 'DefaultEndpointsProtocol=https;AccountName=${storage.name};AccountKey=${listKeys(storage.id, storage.apiVersion).keys[0].value};EndpointSuffix=${environment().suffixes.storage}' // Azure Functions internal setting
}
{
name: 'WEBSITE_RUN_FROM_PACKAGE'
value: '1' // Run Azure Functions from a package file
Expand Down Expand Up @@ -144,16 +130,6 @@ resource authSettings 'Microsoft.Web/sites/config@2021-02-01' = {
}
}

// Azure Storage is required when creating Azure Functions instance
resource functionStorage 'Microsoft.Storage/storageAccounts@2021-06-01' = {
name: functionStorageName
kind: 'StorageV2'
location: location
sku: {
name: functionStorageSKU// You can follow https://aka.ms/teamsfx-bicep-add-param-tutorial to add functionStorageSKUproperty to provisionParameters to override the default value "Standard_LRS".
}
}

// The output will be persisted in .env.{envName}. Visit https://aka.ms/teamsfx-actions/arm-deploy for more details.
output TAB_AZURE_STORAGE_RESOURCE_ID string = storage.id // used in deploy stage
output TAB_DOMAIN string = siteDomain
Expand Down
3 changes: 0 additions & 3 deletions hello-world-tab-with-backend/infra/azure.parameters.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,6 @@
},
"storageSKU": {
"value": "Standard_LRS"
},
"functionStorageSKU": {
"value": "Standard_LRS"
}
}
}
28 changes: 2 additions & 26 deletions intelligent-data-chart-generator/infra/azure.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
@minLength(4)
param resourceBaseName string
param storageSku string
param functionStorageSKU string
param functionAppSKU string
param aadAppClientId string
param aadAppTenantId string
Expand All @@ -11,7 +10,6 @@ param storageName string = resourceBaseName
param location string = resourceGroup().location
param serverfarmsName string = resourceBaseName
param functionAppName string = resourceBaseName
param functionStorageName string = '${resourceBaseName}api'
param teamsAppId string
param openAIChatCompletionUrl string
param sqlUser string
Expand Down Expand Up @@ -82,14 +80,6 @@ resource functionApp 'Microsoft.Web/sites@2021-02-01' = {
allowedOrigins: [ tabEndpoint ]
}
appSettings: [
{
name: ' AzureWebJobsDashboard'
value: 'DefaultEndpointsProtocol=https;AccountName=${functionStorage.name};AccountKey=${listKeys(functionStorage.id, functionStorage.apiVersion).keys[0].value};EndpointSuffix=${environment().suffixes.storage}' // Azure Functions internal setting
}
{
name: 'AzureWebJobsStorage'
value: 'DefaultEndpointsProtocol=https;AccountName=${functionStorage.name};AccountKey=${listKeys(functionStorage.id, functionStorage.apiVersion).keys[0].value};EndpointSuffix=${environment().suffixes.storage}' // Azure Functions internal setting
}
{
name: 'FUNCTIONS_EXTENSION_VERSION'
value: '~4' // Use Azure Functions runtime v4
Expand All @@ -98,10 +88,6 @@ resource functionApp 'Microsoft.Web/sites@2021-02-01' = {
name: 'FUNCTIONS_WORKER_RUNTIME'
value: 'node' // Set runtime to NodeJS
}
{
name: 'WEBSITE_CONTENTAZUREFILECONNECTIONSTRING'
value: 'DefaultEndpointsProtocol=https;AccountName=${storage.name};AccountKey=${listKeys(storage.id, storage.apiVersion).keys[0].value};EndpointSuffix=${environment().suffixes.storage}' // Azure Functions internal setting
}
{
name: 'WEBSITE_RUN_FROM_PACKAGE'
value: '1' // Run Azure Functions from a package file
Expand Down Expand Up @@ -169,11 +155,11 @@ resource functionApp 'Microsoft.Web/sites@2021-02-01' = {
{
name: 'SQL_SERVER'
value: sqlServer
}
}
{
name: 'SQL_DATABASE'
value: sqlDatabase
}
}
]
ftpsState: 'FtpsOnly'
}
Expand All @@ -195,16 +181,6 @@ resource authSettings 'Microsoft.Web/sites/config@2021-02-01' = {
}
}

// Azure Storage is required when creating Azure Functions instance
resource functionStorage 'Microsoft.Storage/storageAccounts@2021-06-01' = {
name: functionStorageName
kind: 'StorageV2'
location: location
sku: {
name: functionStorageSKU // You can follow https://aka.ms/teamsfx-bicep-add-param-tutorial to add functionStorageSKUproperty to provisionParameters to override the default value "Standard_LRS".
}
}

// The output will be persisted in .env.{envName}. Visit https://aka.ms/teamsfx-actions/arm-deploy for more details.
output TAB_AZURE_STORAGE_RESOURCE_ID string = storage.id // used in deploy stage
output TAB_DOMAIN string = siteDomain
Expand Down
3 changes: 0 additions & 3 deletions intelligent-data-chart-generator/infra/azure.parameters.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,6 @@
"functionAppSKU": {
"value": "B1"
},
"functionStorageSKU": {
"value": "Standard_LRS"
},
"teamsAppId": {
"value": "${{TEAMS_APP_ID}}"
},
Expand Down
12 changes: 0 additions & 12 deletions large-scale-notification/infra/azure.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -102,14 +102,6 @@ resource functionApp 'Microsoft.Web/sites@2021-02-01' = {
siteConfig: {
alwaysOn: false
appSettings: [
{
name: 'AzureWebJobsDashboard'
value: 'DefaultEndpointsProtocol=https;AccountName=${storage.name};AccountKey=${listKeys(storage.id, storage.apiVersion).keys[0].value};EndpointSuffix=${environment().suffixes.storage}' // Azure Functions internal setting
}
{
name: 'AzureWebJobsStorage'
value: 'DefaultEndpointsProtocol=https;AccountName=${storage.name};AccountKey=${listKeys(storage.id, storage.apiVersion).keys[0].value};EndpointSuffix=${environment().suffixes.storage}' // Azure Functions internal setting
}
{
name: 'FUNCTIONS_EXTENSION_VERSION'
value: '~4' // Use Azure Functions runtime v4
Expand All @@ -118,10 +110,6 @@ resource functionApp 'Microsoft.Web/sites@2021-02-01' = {
name: 'FUNCTIONS_WORKER_RUNTIME'
value: 'node' // Set runtime to NodeJS
}
{
name: 'WEBSITE_CONTENTAZUREFILECONNECTIONSTRING'
value: 'DefaultEndpointsProtocol=https;AccountName=${storage.name};AccountKey=${listKeys(storage.id, storage.apiVersion).keys[0].value};EndpointSuffix=${environment().suffixes.storage}' // Azure Functions internal setting
}
{
name: 'WEBSITE_RUN_FROM_PACKAGE'
value: '1' // Run Azure Functions from a package file
Expand Down
Loading
Loading