title: What is the correct way to provision an azure app service instance with ACR access?
body: <p>I have been banging my head against the wall of this since yesterday. I have read some SO posts and googled around but I cant seem to get this to work. I want to provision and app service instance in my azure account and I want it to be able to run docker images and pull docker images from an azure container registry. Furthermore I want to do all of this with terraform. What is the correct way to accomplish this? The terraform that I have written looks like this so far, but as mentioned does not work. I get an error</p>
  <blockquote>
  <p>ERROR - Image pull failed: Verify docker image configuration and
  credentials (if using private repository)</p>
  </blockquote>
  <p>Here is the terraform code:</p>
  <pre><code>resource &quot;azurerm_resource_group&quot; &quot;both_rg&quot; {
    name     = &quot;dpt-both&quot;
    location = &quot;West US&quot;
  }
  
  
  resource &quot;azurerm_app_service_plan&quot; &quot;dpt_both_appservice_plan&quot; {
    name                = &quot;dpt-app-service-plan&quot;
    location            = azurerm_resource_group.both_rg.location
    resource_group_name = azurerm_resource_group.both_rg.name
    kind                = &quot;Linux&quot;
    reserved            = true
  
    sku {
      tier = &quot;Standard&quot;
      size = &quot;B1&quot;
    }
  }
  
  resource &quot;azurerm_app_service&quot; &quot;dpt_app_service&quot; {
    name                = &quot;dpt-app-service&quot;
    location            = azurerm_resource_group.both_rg.location
    resource_group_name = azurerm_resource_group.both_rg.name
    app_service_plan_id = azurerm_app_service_plan.dpt_both_appservice_plan.id
    site_config {
      always_on = false
      linux_fx_version  = &quot;DOCKER|dptacr.azurecr.io/dpt-images:latest&quot;
    }
  
    app_settings = {
      DOCKER_REGISTRY_SERVER_URL      = &quot;https://dptacr.azurecr.io&quot;
      DOCKER_REGISTRY_SERVER_USERNAME = &quot;&lt;acr username&gt;&quot;
      DOCKER_REGISTRY_SERVER_PASSWORD = &quot;&lt;acr password&gt;&quot;
    }
  
  }
  
  resource &quot;azurerm_container_registry&quot; &quot;dpt_acr&quot; {
    name                     = &quot;dptAcr&quot;
    resource_group_name      = azurerm_resource_group.both_rg.name
    location                 = azurerm_resource_group.both_rg.location
    sku                      = &quot;Basic&quot;
    admin_enabled            = true
    public_network_access_enabled = true
  }
  </code></pre>