Azure App Service (Web Apps) Source Control Token

This page shows how to write Terraform for App Service (Web Apps) Source Control Token and write them securely.

azurerm_app_service_source_control_token (Terraform)

The Source Control Token in App Service (Web Apps) can be configured in Terraform with the resource name azurerm_app_service_source_control_token. The following sections describe 4 examples of how to use the resource and its parameters.

Example Usage from GitHub

main.tf#L1
resource "azurerm_app_service_source_control_token" "example" {
  type  = var.type
  token = var.token
main.tf#L17
resource "azurerm_app_service_source_control_token" "dobble_token" {
  type  = "GitHub"
  token = "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"
}

resource "azurerm_app_service" "dobble" {
main.tf#L7
resource "azurerm_app_service_source_control_token" "this" {
  token        = var.token
  token_secret = var.token_secret
  type         = var.type

  dynamic "timeouts" {
main.tf#L7
resource "azurerm_app_service_source_control_token" "this" {
  token        = var.token
  token_secret = var.token_secret
  type         = var.type

  dynamic "timeouts" {

Review your Terraform file for Azure best practices

Shisho Cloud, our free checker to make sure your Terraform configuration follows best practices, is available (beta).

Parameters

Explanation in Terraform Registry

Manages an App Service source control token.

NOTE: Source Control Tokens are configured at the subscription level, not on each App Service - as such this can only be configured Subscription-wide

Tips: Best Practices for The Other Azure App Service (Web Apps) Resources

In addition to the azurerm_app_service, Azure App Service (Web Apps) has the other resources that should be configured for security reasons. Please check some examples of those resources and precautions.

risk-label

azurerm_app_service

Ensure your App Service is accessible via HTTPS only

It is better to configure the App Service to be accessible via HTTPS only. By default, both HTTP and HTTPS are available.

risk-label

azurerm_function_app

Ensure to enable authentication to prevent anonymous request being accepted

It is better to enable authentication to prevent anonymous requests and ensure all communications in the application are authenticated.

Review your Azure App Service (Web Apps) settings

In addition to the above, there are other security points you should be aware of making sure that your .tf files are protected in Shisho Cloud.

Azure Resource Manager Example

Azure Resource Manager code does not have the related resource.

Frequently asked questions

What is Azure App Service (Web Apps) Source Control Token?

Azure App Service (Web Apps) Source Control Token is a resource for App Service (Web Apps) of Microsoft Azure. Settings can be wrote in Terraform.

Where can I find the example code for the Azure App Service (Web Apps) Source Control Token?

For Terraform, the VentsislavDinev/en_sample, svadali2/dobble and kevinhead/azurerm source code examples are useful. See the Terraform Example section for further details.