title: Azure Function Runtime version being set to ~1 when deployed
body: <p>I have an AzureDevOps pipeline that deploys an Azure Function using the following ARM Template:</p>
  <pre><code>{
      &quot;$schema&quot;: &quot;https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#&quot;,
      &quot;contentVersion&quot;: &quot;1.0.0.0&quot;,
      &quot;parameters&quot;: {
          &quot;functionAppCSName&quot;: {
              &quot;type&quot;: &quot;string&quot;
          },
          &quot;storageAccountName&quot;: {
              &quot;type&quot;: &quot;string&quot;
          },
          &quot;storageAccountType&quot;: {
              &quot;type&quot;: &quot;string&quot;,
              &quot;defaultValue&quot;: &quot;Standard_LRS&quot;,
              &quot;metadata&quot;: {
                  &quot;description&quot;: &quot;Geo-replication type of Storage account&quot;
              },
              &quot;allowedValues&quot;: [
                  &quot;Standard_LRS&quot;,
                  &quot;Standard_GRS&quot;,
                  &quot;Standard_ZRS&quot;,
                  &quot;Standard_RGRS&quot;
              ]
          },
          &quot;serverFarmsName&quot;: {
              &quot;type&quot;: &quot;string&quot;
          },
          &quot;appInsightsName&quot;: {
              &quot;type&quot;: &quot;string&quot;
          },
          &quot;appinsightResourceGroupName&quot;: {
              &quot;type&quot;: &quot;string&quot;
          },
          &quot;webURL&quot;: {
              &quot;type&quot;: &quot;string&quot;
          },
          &quot;vaultName&quot;: {
              &quot;type&quot;: &quot;string&quot;
          },
          &quot;sspVaultName&quot;: {
              &quot;type&quot;: &quot;string&quot;
          },
          &quot;marketplaceVaultName&quot;: {
              &quot;type&quot;: &quot;string&quot;
          },
          &quot;redisRgName&quot;: {
              &quot;type&quot;: &quot;string&quot;
          },
          &quot;redisName&quot;: {
              &quot;type&quot;: &quot;string&quot;
          },
          &quot;environment&quot;: {
              &quot;type&quot;: &quot;string&quot;
          },
          &quot;aadTenant&quot;: {
              &quot;type&quot;: &quot;string&quot;
          },
          &quot;aadClientId&quot;: {
              &quot;type&quot;: &quot;string&quot;
          },
          &quot;audience&quot;: {
              &quot;type&quot;: &quot;string&quot;
          },
          &quot;location&quot;: {
              &quot;type&quot;: &quot;string&quot;
          }
      },
      &quot;resources&quot;: [
          {
              &quot;type&quot;: &quot;Microsoft.Storage/storageAccounts&quot;,
              &quot;name&quot;: &quot;[parameters('storageAccountName')]&quot;,
              &quot;location&quot;: &quot;[parameters('location')]&quot;,
              &quot;apiVersion&quot;: &quot;2019-04-01&quot;,
              &quot;sku&quot;: {
                  &quot;name&quot;: &quot;[parameters('storageAccountType')]&quot;
              },
              &quot;kind&quot;: &quot;StorageV2&quot;,
              &quot;properties&quot;: {
              }
          },
          {
              &quot;type&quot;: &quot;Microsoft.Web/sites&quot;,
              &quot;kind&quot;: &quot;functionapp&quot;,
              &quot;name&quot;: &quot;[parameters('functionAppCSName')]&quot;,
              &quot;apiVersion&quot;: &quot;2016-08-01&quot;,
              &quot;location&quot;: &quot;[parameters('location')]&quot;,
              &quot;dependsOn&quot;: [
                  &quot;[resourceId('Microsoft.Storage/storageAccounts', parameters('storageAccountName'))]&quot;
              ],
              &quot;identity&quot;: {
                  &quot;type&quot;: &quot;SystemAssigned&quot;
              },
              &quot;tags&quot;: {
              },
              &quot;properties&quot;: {
                  &quot;httpsOnly&quot;: true,
                  &quot;enabled&quot;: true,
                  &quot;serverFarmId&quot;: &quot;[resourceId('Microsoft.Web/serverfarms', parameters('serverFarmsName'))]&quot;,
                  &quot;reserved&quot;: false,
                  &quot;siteConfig&quot;: {
                      &quot;AlwaysOn&quot;: true,
                      &quot;ftpsState&quot;: &quot;Disabled&quot;
                  },
                  &quot;clientAffinityEnabled&quot;: true,
                  &quot;clientCertEnabled&quot;: false,
                  &quot;hostNamesDisabled&quot;: false,
                  &quot;containerSize&quot;: 1536,
                  &quot;dailyMemoryTimeQuota&quot;: 0,
                  &quot;remoteDebuggingEnabled&quot;: false,
                  &quot;webSocketsEnabled&quot;: false
              },
              &quot;resources&quot;: [
                  {
                      &quot;apiVersion&quot;: &quot;2016-08-01&quot;,
                      &quot;name&quot;: &quot;appsettings&quot;,
                      &quot;type&quot;: &quot;config&quot;,
                      &quot;dependsOn&quot;: [
                          &quot;[resourceId('Microsoft.Web/Sites', parameters('functionAppCSName'))]&quot;
                      ],
                      &quot;properties&quot;: {
                          &quot;SSPSYSTEM_KEYVAULT_URI&quot;: &quot;[concat('https://',parameters('sspvaultname'),'.vault.azure.net')]&quot;,
                          &quot;SSP_KEYVAULT_URI&quot;: &quot;[concat('https://',parameters('vaultName'),'.vault.azure.net')]&quot;,
                          &quot;MP_KEYVAULT_URI&quot;: &quot;[concat('https://',parameters('marketplaceVaultName'),'.vault.azure.net')]&quot;,
                          &quot;AzureWebJobsStorage&quot;: &quot;[concat('DefaultEndpointsProtocol=https;AccountName=', parameters('storageAccountName'), ';AccountKey=', listKeys(parameters('storageAccountName'),'2019-06-01').keys[0].value)]&quot;,
                          &quot;AzureWebJobsDashboard&quot;: &quot;[concat('DefaultEndpointsProtocol=https;AccountName=', parameters('storageAccountName'), ';AccountKey=', listKeys(parameters('storageAccountName'),'2019-06-01').keys[0].value)]&quot;,
                          &quot;FUNCTIONS_EXTENSION_VERSION&quot;: &quot;~3&quot;,
                          &quot;AzureWebJobsSecretStorageType&quot;: &quot;Files&quot;,
                          &quot;APPINSIGHTS_INSTRUMENTATIONKEY&quot;: &quot;[reference(resourceId(parameters('appinsightResourceGroupName'),'Microsoft.Insights/components', parameters('appInsightsName')), '2014-04-01').InstrumentationKey]&quot;,
                          &quot;CacheConnectionString&quot;: &quot;[concat(parameters('redisName'),'.redis.cache.windows.net,abortConnect=false,ssl=true,password=', listKeys(resourceId(parameters('redisRgName'),'Microsoft.Cache/Redis',parameters('redisName')), '2015-08-01').primaryKey)]&quot;,
                          &quot;AssetCacheKey&quot;: &quot;[parameters('environment')]&quot;
                      }
                  },
                  {
                      &quot;comments&quot;: &quot;CORS allow origins *.&quot;,
                      &quot;type&quot;: &quot;Microsoft.Web/sites/config&quot;,
                      &quot;name&quot;: &quot;[concat(parameters('functionAppCSName'), '/web')]&quot;,
                      &quot;apiVersion&quot;: &quot;2016-08-01&quot;,
                      &quot;properties&quot;: {
                          &quot;cors&quot;: {
                              &quot;allowedOrigins&quot;: [
                                  &quot;https://functions.azure.com&quot;,
                                  &quot;https://functions-staging.azure.com&quot;,
                                  &quot;https://functions-next.azure.com&quot;,
                                  &quot;[parameters('webURL')]&quot;,
                                  &quot;http://localhost:4200&quot;
                              ]
                          }
                      },
                      &quot;dependsOn&quot;: [
                          &quot;[concat('Microsoft.Web/sites/', parameters('functionAppCSName'))]&quot;,
                          &quot;[concat('Microsoft.Storage/storageAccounts/', parameters('storageAccountName'))]&quot;
                      ]
                  },
                  {
                      &quot;type&quot;: &quot;config&quot;,
                      &quot;name&quot;: &quot;logs&quot;,
                      &quot;apiVersion&quot;: &quot;2016-08-01&quot;,
                      &quot;location&quot;: &quot;[parameters('location')]&quot;,
                      &quot;dependsOn&quot;: [
                          &quot;[concat('Microsoft.Web/sites/', parameters('functionAppCSName'))]&quot;,
                          &quot;[concat('Microsoft.Storage/storageAccounts/', parameters('storageAccountName'))]&quot;
                      ],
                      &quot;properties&quot;: {
                          &quot;remoteDebuggingEnabled&quot;: false,
                          &quot;webSocketsEnabled&quot;: false,
                          &quot;applicationLogs&quot;: {
                              &quot;fileSystem&quot;: {
                                  &quot;level&quot;: &quot;Off&quot;
                              },
                              &quot;azureTableStorage&quot;: {
                                  &quot;level&quot;: &quot;Off&quot;,
                                  &quot;sasUrl&quot;: null
                              },
                              &quot;azureBlobStorage&quot;: {
                                  &quot;level&quot;: &quot;Verbose&quot;,
                                  &quot;sasUrl&quot;: &quot;url&quot;,
                                  &quot;retentionInDays&quot;: 7
                              },
                              &quot;httpLogs&quot;: {
                                  &quot;fileSystem&quot;: {
                                      &quot;retentionInMb&quot;: 365,
                                      &quot;retentionInDays&quot;: 365,
                                      &quot;enabled&quot;: true
                                  },
                                  &quot;azureBlobStorage&quot;: {
                                      &quot;sasUrl&quot;: &quot;url&quot;,
                                      &quot;retentionInDays&quot;: 365,
                                      &quot;enabled&quot;: true
                                  }
                              },
                              &quot;failedRequestsTracing&quot;: {
                                  &quot;enabled&quot;: true
                              },
                              &quot;detailedErrorMessages&quot;: {
                                  &quot;enabled&quot;: true
                              }
                          }
                      }
                  },
                  {
                      &quot;name&quot;: &quot;[concat(parameters('functionAppCSName'), '/authsettings')]&quot;,
                      &quot;apiVersion&quot;: &quot;2016-08-01&quot;,
                      &quot;type&quot;: &quot;Microsoft.Web/sites/config&quot;,
                      &quot;location&quot;: &quot;[parameters('location')]&quot;,
                      &quot;dependsOn&quot;: [
                          &quot;[resourceId('Microsoft.Web/sites', parameters('functionAppCSName'))]&quot;
                      ],
                      &quot;properties&quot;: {
                          &quot;enabled&quot;: true,
                          &quot;tokenStoreEnabled&quot;: true,
                          &quot;defaultProvider&quot;: &quot;AzureActiveDirectory&quot;,
                          &quot;clientId&quot;: &quot;[parameters('aadClientId')]&quot;,
                          &quot;issuer&quot;: &quot;[concat('https://login.microsoftonline.com/', parameters('aadTenant'))]&quot;,
                          &quot;allowedAudiences&quot;: [
                              &quot;[parameters('audience')]&quot;
                          ]
                      }
                  }
              ]
          }
      ],
      &quot;outputs&quot;: {
          &quot;tenantID&quot;: {
              &quot;type&quot;: &quot;string&quot;,
              &quot;value&quot;: &quot;[reference(resourceId('Microsoft.Web/sites', parameters('functionAppCSName')),'2020-06-01', 'Full').identity.tenantId]&quot;
          },
          &quot;objectId&quot;: {
              &quot;type&quot;: &quot;string&quot;,
              &quot;value&quot;: &quot;[reference(resourceId('Microsoft.Web/sites', parameters('functionAppCSName')),'2020-06-01', 'Full').identity.principalId]&quot;
          }
      }
  }
  </code></pre>
  <p>As you can see, I am setting the <strong>Runtime version</strong> of the Function App by doing the following:</p>
  <pre><code>...
  {
                      &quot;apiVersion&quot;: &quot;2016-08-01&quot;,
                      &quot;name&quot;: &quot;appsettings&quot;,
                      &quot;type&quot;: &quot;config&quot;,
                      &quot;dependsOn&quot;: [
                          &quot;[resourceId('Microsoft.Web/Sites', parameters('functionAppCSName'))]&quot;
                      ],
                      &quot;properties&quot;: {
                          &quot;SSPSYSTEM_KEYVAULT_URI&quot;: &quot;[concat('https://',parameters('sspvaultname'),'.vault.azure.net')]&quot;,
                          &quot;SSP_KEYVAULT_URI&quot;: &quot;[concat('https://',parameters('vaultName'),'.vault.azure.net')]&quot;,
                          &quot;MP_KEYVAULT_URI&quot;: &quot;[concat('https://',parameters('marketplaceVaultName'),'.vault.azure.net')]&quot;,
                          &quot;AzureWebJobsStorage&quot;: &quot;[concat('DefaultEndpointsProtocol=https;AccountName=', parameters('storageAccountName'), ';AccountKey=', listKeys(parameters('storageAccountName'),'2019-06-01').keys[0].value)]&quot;,
                          &quot;AzureWebJobsDashboard&quot;: &quot;[concat('DefaultEndpointsProtocol=https;AccountName=', parameters('storageAccountName'), ';AccountKey=', listKeys(parameters('storageAccountName'),'2019-06-01').keys[0].value)]&quot;,
                          &quot;FUNCTIONS_EXTENSION_VERSION&quot;: &quot;~3&quot;,
                          &quot;AzureWebJobsSecretStorageType&quot;: &quot;Files&quot;,
                          &quot;APPINSIGHTS_INSTRUMENTATIONKEY&quot;: &quot;[reference(resourceId(parameters('appinsightResourceGroupName'),'Microsoft.Insights/components', parameters('appInsightsName')), '2014-04-01').InstrumentationKey]&quot;,
                          &quot;CacheConnectionString&quot;: &quot;[concat(parameters('redisName'),'.redis.cache.windows.net,abortConnect=false,ssl=true,password=', listKeys(resourceId(parameters('redisRgName'),'Microsoft.Cache/Redis',parameters('redisName')), '2015-08-01').primaryKey)]&quot;,
                          &quot;AssetCacheKey&quot;: &quot;[parameters('environment')]&quot;
                      }
                  }
  ...
  
  </code></pre>
  <p>The problem is when the function gets deployed, the Runtime Version is always set to 1~ and the only way I fix it is by deleting the Function App and redeploy again or running a redeploy on the pipeline over and over again until it becomes ~3.</p>
  <p>This is really frustrating for us as we can't have a proper or smooth deployment.</p>
  <p>Is there something that I'm missing in terms of the ARM Template?</p>