For AI agents: A markdown version of this page is available at https://docs.datadoghq.com/security/code_security/iac_security/iac_rules/terraform-azure-app-service-without-latest-python-version.md.
A documentation index is available at /llms.txt.
It is recommended to specify the latest supported Python version for the python_version attribute in the site_config block of the azurerm_app_service resource. Using outdated Python versions, such as "python_version = \"2.7\"", exposes your application to known security vulnerabilities and prevents access to important features and security updates available in newer releases. To reduce risk, configure the resource with an up-to-date version. For example:
site_config {
python_version = "3.10"
}
Compliant Code Examples
resource"azurerm_app_service""example1"{name="example1-app-service"location=azurerm_resource_group.example.locationresource_group_name=azurerm_resource_group.example.nameapp_service_plan_id=azurerm_app_service_plan.example.id # SiteConfig block is optional before AzureRM version 3.0
site_config{dotnet_framework_version="v4.0"scm_type="LocalGit"python_version="3.10"}app_settings={"SOME_KEY"="some-value"}connection_string{name="Database"type="SQLServer"value="Server=some-server.mydomain.com;Integrated Security=SSPI"}}
resource"azurerm_app_service""example4"{name="example4-app-service"location=azurerm_resource_group.example.locationresource_group_name=azurerm_resource_group.example.nameapp_service_plan_id=azurerm_app_service_plan.example.id # SiteConfig block is optional before AzureRM version 3.0
site_config{dotnet_framework_version="v4.0"scm_type="LocalGit"python_version="2.7"}app_settings={"SOME_KEY"="some-value"}connection_string{name="Database"type="SQLServer"value="Server=some-server.mydomain.com;Integrated Security=SSPI"}}