Grants access to the specified project for the specified access role. This API endpoint is one step in a procedure to create unified access for MongoDB Cloud services. This is not required for GCP service account access.
Role requirements
- Project Owner
PATCH
/api/atlas/v2/groups/{groupId}/cloudProviderAccess/{roleId}
Atlas CLI
atlas api cloudProviderAccess authorizeProviderAccessRole --help
import (
"os"
"context"
"log"
sdk "go.mongodb.org/atlas-sdk/v20240530001/admin"
)
func main() {
ctx := context.Background()
clientID := os.Getenv("MONGODB_ATLAS_CLIENT_ID")
clientSecret := os.Getenv("MONGODB_ATLAS_CLIENT_SECRET")
// See https://dochub.mongodb.org/core/atlas-go-sdk-oauth
client, err := sdk.NewClient(sdk.UseOAuthAuth(clientID, clientSecret))
if err != nil {
log.Fatalf("Error: %v", err)
}
params = &sdk.AuthorizeGroupCloudProviderAccessRoleApiParams{}
sdkResp, httpResp, err := client.CloudProviderAccessApi.
AuthorizeGroupCloudProviderAccessRoleWithParams(ctx, params).
Execute()
}
curl --include --header "Authorization: Bearer ${ACCESS_TOKEN}" \
--header "Accept: application/vnd.atlas.2024-05-30+json" \
--header "Content-Type: application/json" \
-X PATCH "https://cloud.mongodb.com/api/atlas/v2/groups/{groupId}/cloudProviderAccess/{roleId}" \
-d '{ <Payload> }'
curl --user "${PUBLIC_KEY}:${PRIVATE_KEY}" \
--digest --include \
--header "Accept: application/vnd.atlas.2024-05-30+json" \
--header "Content-Type: application/json" \
-X PATCH "https://cloud.mongodb.com/api/atlas/v2/groups/{groupId}/cloudProviderAccess/{roleId}" \
-d '{ <Payload> }'
Request examples
Aws
{
"providerName": "AWS",
"iamAssumedRoleArn": "arn:aws:iam::123456789012:root"
}
{
"providerName": "AZURE",
"atlasAzureAppId": "string",
"servicePrincipalId": "string",
"tenantId": "string"
}
{
"providerName": "GCP"
}
Response examples (200)
Aws
AWS
{
"atlasAWSAccountArn": "arn:aws:iam::772401394250:role/my-test-aws-role",
"atlasAssumedRoleExternalId": "feb2dfc7-f760-4288-a403-01c7c2345005",
"authorizedDate": "2024-05-30T14:12:00Z",
"createdDate": "2024-05-30T14:11:00Z",
"featureUsages": [],
"iamAssumedRoleArn": "arn:aws:iam::123456789012:root",
"providerName": "AWS",
"roleId": "32b6e34b3d91647abb20e7b8"
}
Azure
{
"_id": "32b6e34b3d91647abb20e7b8",
"atlasAzureAppId": "da5dd062-f3ca-4cb5-b86a-05f82203ab67",
"createdDate": "2024-05-30T14:11:00Z",
"featureUsages": [],
"lastUpdatedDate": "2024-05-30T14:12:00Z",
"providerName": "AZURE",
"servicePrincipalId": "ec8e7844-912d-4869-86e9-6d0dfca4b8af",
"tenantId": "4297fc77-1592-4de8-a6d5-a8c32401df87"
}
GCP
{
"createdDate": "2024-05-30T14:11:00Z",
"featureUsages": [],
"gcpServiceAccountForAtlas": "mongodb-atlas-1234567890123456@p-111111111111111111111111.iam.gserviceaccount.com",
"providerName": "GCP",
"roleId": "32b6e34b3d91647abb20e7b8",
"status": "COMPLETE"
}
Response examples (400)
{
"detail": "(This is just an example, the exception may not be related to this endpoint) No provider AWS exists.",
"error": 400,
"errorCode": "VALIDATION_ERROR",
"reason": "Bad Request"
}
Response examples (401)
{
"detail": "(This is just an example, the exception may not be related to this endpoint)",
"error": 401,
"errorCode": "NOT_ORG_GROUP_CREATOR",
"reason": "Unauthorized"
}
Response examples (403)
{
"detail": "(This is just an example, the exception may not be related to this endpoint)",
"error": 403,
"errorCode": "CANNOT_CHANGE_GROUP_NAME",
"reason": "Forbidden"
}
Response examples (404)
{
"detail": "(This is just an example, the exception may not be related to this endpoint) Cannot find resource AWS",
"error": 404,
"errorCode": "RESOURCE_NOT_FOUND",
"reason": "Not Found"
}
Response examples (409)
{
"detail": "(This is just an example, the exception may not be related to this endpoint) Cannot delete organization link while there is active migration in following project ids: 60c4fd418ebe251047c50554",
"error": 409,
"errorCode": "CANNOT_DELETE_ORG_ACTIVE_LIVE_MIGRATION_ATLAS_ORG_LINK",
"reason": "Conflict"
}
Response examples (429)
{
"detail": "(This is just an example, the exception may not be related to this endpoint)",
"error": 429,
"errorCode": "RATE_LIMITED",
"reason": "Too Many Requests"
}
Response examples (500)
{
"detail": "(This is just an example, the exception may not be related to this endpoint)",
"error": 500,
"errorCode": "UNEXPECTED_ERROR",
"reason": "Internal Server Error"
}