Tenant id not recognized

This is the error I get when I use terraform apply:
2023-12-29T19:06:04.870+0100 [DEBUG] provider.terraform-provider-azurerm_v3.0.2_x5: AzureRM Response Error: Get “https://management.azure.com/subscriptions/f2979ae9-a7f5-41de-b69f-38018a8d18d1/providers?api-version=2016-02-01”: dial tcp: lookup management.azure.com on 172.31.240.1:53: cannot unmarshal DNS message for https://management.azure.com/subscriptions/2979ae9-a7f5-41de-b69f-38018a8d18d1/providers?api-version=2016-02-01: timestamp=“2023-12-29T19:06:04.870+0100”,
Furthermore, if I check the environment variables I get an error 90002 for tenant ID, which is set correctly. How can I fix this as I used all the solutions provided in the documentation but nothing works?