This could fail if the tenantId happened to be credential_key[1], as this is a dict and the order is not guaranteed. We should probably be more specific.