If you are passing the password to the connection string, pyodbc automatically tries to use SQL Server authentication, because it is only one authentication method which supports password passing to connection string.
But your code is using Active Directory authentication which isn't supports the authentication with password.
You should use passwordless authentication, if your code is running on Windows machine, you could use this guide to setup paswordless auth - Migrate a Python application to use passwordless connections with Azure SQL Database , if it is running on Linux machine you should configure Kerberos first - Authenticating a Linux or macOS Computer with Active Directory