Thank you Jason!
I achieved it using a similar process but through the Atlas API: https://docs.atlas.mongodb.com/reference/api/cloud-provider-access-get-roles/#get-all-cloud-provider-access-roles