> ## Documentation Index
> Fetch the complete documentation index at: https://cloudanix.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Configure Minimum TLS Version

### More Info:

Ensure that the Minimum TLS version setting is set to "Version 1.2" for all Azure Storage accounts.

### Risk Level

Medium

### Address

Security

### Compliance Standards

SOC2, ISO27001, CBP

### Triage and Remediation

<Tabs>
  <Tab title="Remediation">
    ### Remediation

    <AccordionGroup>
      <Accordion title="Using Console" defaultOpen="true">
        To remediate the "Configure Minimum TLS Version" misconfiguration in Azure using the Azure console, follow these steps:

        1. Log in to the Azure portal.

        2. Navigate to the resource group containing the affected resource.

        3. Select the resource that needs to be remediated.

        4. Click on the "Networking" tab in the left-hand menu.

        5. Scroll down to the "SSL/TLS settings" section and click on "Edit".

        6. In the "Minimum TLS version" dropdown, select the desired minimum version of TLS that should be used.

        7. Click on "Save" to apply the changes.

        8. Verify that the changes have been applied by running a scan or checking the security compliance report.

        Note: It is recommended to use TLS 1.2 or higher as the minimum version to ensure the security of your resources.

        #
      </Accordion>

      <Accordion title="Using CLI">
        To remediate the "Configure Minimum TLS Version" misconfiguration for AZURE using AZURE CLI, follow these steps:

        1. Open the Azure CLI and log in to your Azure account.

        2. Run the following command to set the minimum TLS version to 1.2 for all web apps in your subscription:

           ```
           az webapp config set --min-tls-version 1.2 --ids $(az webapp list --query "[].id" --output tsv)
           ```

           This command uses the `az webapp config set` command to set the minimum TLS version to 1.2 for all web apps in your subscription. The `--ids` parameter uses the `az webapp list` command to get a list of all web app IDs in your subscription and passes them to the `az webapp config set` command.

        3. Verify that the minimum TLS version has been set correctly by running the following command:

           ```
           az webapp config show --query "minTlsVersion" --ids $(az webapp list --query "[].id" --output tsv)
           ```

           This command uses the `az webapp config show` command to display the minimum TLS version for all web apps in your subscription.

        4. Repeat the above steps for all web apps in your subscription to ensure that the minimum TLS version is set correctly for each app.

        By following these steps, you can remediate the "Configure Minimum TLS Version" misconfiguration for AZURE using AZURE CLI.
      </Accordion>

      <Accordion title="Using Python">
        To remediate the "Configure Minimum TLS Version" misconfiguration in Azure using Python, you can follow the below steps:

        1. Import the necessary libraries:

        ```python theme={null}
        from azure.mgmt.web import WebSiteManagementClient
        from azure.common.credentials import ServicePrincipalCredentials
        ```

        2. Set the credentials for your Azure account using ServicePrincipalCredentials:

        ```python theme={null}
        subscription_id = 'your_subscription_id'
        client_id = 'your_client_id'
        secret = 'your_client_secret'
        tenant = 'your_tenant_id'

        credentials = ServicePrincipalCredentials(
            client_id=client_id,
            secret=secret,
            tenant=tenant
        )
        ```

        3. Create a WebSiteManagementClient object using the credentials:

        ```python theme={null}
        web_client = WebSiteManagementClient(credentials, subscription_id)
        ```

        4. Get the resource group name and app service name for the app you want to remediate:

        ```python theme={null}
        resource_group_name = 'your_resource_group_name'
        app_service_name = 'your_app_service_name'
        ```

        5. Get the current TLS version settings for the app:

        ```python theme={null}
        app_settings = web_client.web_apps.list_application_settings(resource_group_name, app_service_name)
        tls_version = app_settings.properties['WEBSITE_TLS_MIN_VERSION']
        ```

        6. Check if the current TLS version is less than the desired version (e.g. TLS 1.2):

        ```python theme={null}
        if tls_version != '1.2':
            app_settings.properties['WEBSITE_TLS_MIN_VERSION'] = '1.2'
            web_client.web_apps.update_application_settings(resource_group_name, app_service_name, app_settings)
        ```

        7. If the current TLS version is less than the desired version, update the app settings to set the minimum TLS version to TLS 1.2.

        This will remediate the "Configure Minimum TLS Version" misconfiguration for your Azure app using Python.
      </Accordion>
    </AccordionGroup>
  </Tab>
</Tabs>
