-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
13 changed files
with
323 additions
and
51 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 |
---|---|---|
@@ -0,0 +1,91 @@ | ||
#az login | ||
|
||
$resourceGroupName = "FuncsResourceGroup" | ||
$location = "eastus" | ||
$storageAccountName = "funcsstorageaccount" | ||
$azureFunctionsPremiumPlanName = "FuncsPremiumPlan" | ||
$appName = "SimpleFuncs" | ||
#$appInsightsName = $appName + "Insight"; | ||
|
||
az group create ` | ||
-l $location ` | ||
-n $resourceGroupName | ||
|
||
az storage account create ` | ||
-g $resourceGroupName ` | ||
-n $storageAccountName ` | ||
-l $location ` | ||
--sku Standard_LRS | ||
|
||
az functionapp plan create ` | ||
--resource-group $resourceGroupName ` | ||
--name $azureFunctionsPremiumPlanName ` | ||
--location $location ` | ||
--number-of-workers 1 ` | ||
--sku EP1 ` | ||
--is-linux | ||
|
||
az functionapp create --name $appName ` | ||
--storage-account $storageAccountName ` | ||
--resource-group $resourceGroupName ` | ||
--plan $azureFunctionsPremiumPlanName ` | ||
--runtime dotnet ` | ||
--functions-version 3 | ||
|
||
az functionapp deployment slot create ` | ||
--resource-group $resourceGroupName ` | ||
--name $appName ` | ||
-slot staging | ||
|
||
az cosmosdb create ` | ||
--name $storageAccountName ` | ||
--resource $resourceGroupName ` | ||
--default-consistency-level Eventual ` | ||
--locations regionName=$location failoverPriority=0 isZoneRedundant=False | ||
|
||
|
||
$appInsightsInstrumentationKey="$(az resource show -g $resourceGroupName -n $appName --resource-type 'Microsoft.Insights/components' --query properties.InstrumentationKey)" | ||
# this instrumentation key comes with quotes, which we need to remove | ||
$appInsightsInstrumentationKey = $appInsightsInstrumentationKey -replace '"', "" | ||
|
||
#storage connection string | ||
$storageConnectionString = "$(az storage account show-connection-string ` | ||
--resource-group $($resourceGroupName) ` | ||
--name $($storageAccountName) ` | ||
--query connectionString ` | ||
--output tsv)" | ||
|
||
$cosmosConnectionString = "$(az cosmosdb keys list ` | ||
--type connection-strings ` | ||
--name $storageAccountName ` | ||
--resource-group $resourceGroupName ` | ||
--query connectionStrings[0].connectionString)" | ||
|
||
|
||
$settings = @( | ||
"APPINSIGHTS_INSTRUMENTATIONKEY=$appInsightsInstrumentationKey", | ||
"AzureWebJobsStorage=$storageConnectionString", | ||
"WEBSITE_RUN_FROM_PACKAGE=1", | ||
"Cosmos:ConnectionString=$cosmosConnectionString", | ||
"Cosmos:DatabaseId=FunctionsData", | ||
"Cosmos:ContainerId=Primes" | ||
) | ||
|
||
az webapp config appsettings set ` | ||
--resource-group $resourceGroupName ` | ||
--name $appName ` | ||
--settings $settings ` | ||
|
||
//---------- | ||
|
||
// CI-CD | ||
|
||
az functionapp deployment container config --enable-cd --query CI_CD_URL ` | ||
--output tsv ` | ||
--name $appName ` | ||
--resource-group $resourceGroupName | ||
|
||
az functionapp deployment container show-cd-url --name $appName ` | ||
--resource-group $resourceGroupName | ||
|
||
func azure functionapp fetch-app-settings $appName |
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
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
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
18 changes: 18 additions & 0 deletions
18
src/AzureFunctions/Properties/PublishProfiles/SimpleFuncs - Zip Deploy.pubxml
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 |
---|---|---|
@@ -0,0 +1,18 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<!-- | ||
https://go.microsoft.com/fwlink/?LinkID=208121. | ||
--> | ||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||
<PropertyGroup> | ||
<WebPublishMethod>ZipDeploy</WebPublishMethod> | ||
<PublishProvider>AzureWebSite</PublishProvider> | ||
<LastUsedBuildConfiguration>Release</LastUsedBuildConfiguration> | ||
<LastUsedPlatform>Any CPU</LastUsedPlatform> | ||
<SiteUrlToLaunchAfterPublish>http://simplefuncs.azurewebsites.net</SiteUrlToLaunchAfterPublish> | ||
<LaunchSiteAfterPublish>False</LaunchSiteAfterPublish> | ||
<ResourceId>/subscriptions/0edc09bb-e123-4bb8-8f5a-9b382654704a/resourceGroups/FuncsResourceGroup/providers/Microsoft.Web/sites/SimpleFuncs</ResourceId> | ||
<UserName>$SimpleFuncs</UserName> | ||
<_SavePWD>True</_SavePWD> | ||
<PublishUrl>https://simplefuncs.scm.azurewebsites.net/</PublishUrl> | ||
</PropertyGroup> | ||
</Project> |
67 changes: 67 additions & 0 deletions
67
...reFunctions/Properties/ServiceDependencies/SimpleFuncs - Zip Deploy/appInsights1.arm.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 |
---|---|---|
@@ -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": "FuncsResourceGroup", | ||
"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('SimpleFuncs', 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": [ | ||
{ | ||
"name": "SimpleFuncs", | ||
"type": "microsoft.insights/components", | ||
"location": "[parameters('resourceLocation')]", | ||
"kind": "web", | ||
"properties": {}, | ||
"apiVersion": "2015-05-01" | ||
} | ||
] | ||
} | ||
} | ||
} | ||
], | ||
"metadata": { | ||
"_dependencyType": "appInsights.azure" | ||
} | ||
} |
Oops, something went wrong.