@AmandaCH In this case, you are using $cred for application credentials. However, Azure AD is looking for a user account with those credentials. You need to add -ServicePrincipal switch to the command to instruct Azure AD to look for application rather than user account. Below is how the command should look:
Login-AzureRmAccount -ServicePrincipal -Credential $cred -TenantId "Tenant ID"
-----------------------------------------------------------------------------------------------------------
Please "mark as answer" or "vote as helpful" wherever the information provided helps you to help others in the community.