From ab4d963bd49f6469f8267e75a8c29db676c6cafe Mon Sep 17 00:00:00 2001 From: Stefan Eguizabal <36928878+sweetsweetstefan@users.noreply.github.com> Date: Tue, 16 Sep 2025 10:46:50 -0400 Subject: [PATCH] Article for list environment roles --- .../automation-list-roles-for-environment.md | 34 +++++++++++++++++++ layout.yaml | 1 + 2 files changed, 35 insertions(+) create mode 100644 en/automation/automation-list-roles-for-environment.md diff --git a/en/automation/automation-list-roles-for-environment.md b/en/automation/automation-list-roles-for-environment.md new file mode 100644 index 00000000..0bcf1cd1 --- /dev/null +++ b/en/automation/automation-list-roles-for-environment.md @@ -0,0 +1,34 @@ +--- +title: "List all roles for an environment" +slug: automation-list-roles-for-environment +--- + + +This article will show you how to retrieve all the available roles for a given environment. + +## Before you begin + +- You will need a valid API key +- You must have access to the target environment +- You must have the environment ID for the target environment + +## API call + +```bourne +curl --request GET \ + --url https://{endpoint-url}/api/v2/roles?default_scope=ENV&environment_id={environment-id} \ + --header 'Content-Type: application/json' \ + --header 'MC-Api-Key: {api-key}' +``` + +## Result + +- The response will contain all environment roles available in the specified environment +- You may now search through the response to identify the desired role in the `data/name` and `data/id` fields + +## Discussion + +To find the environment ID, log into the Web UI and navigate to the service which contains the target environment. In the list of environments, identify the target environment, click on the Hidden Actions menu at the far right, and select **Copy environment ID**. + +The environment ID can also be retrieved via the API. + diff --git a/layout.yaml b/layout.yaml index 520d34d2..da1075dd 100644 --- a/layout.yaml +++ b/layout.yaml @@ -130,5 +130,6 @@ categories: articles: - automation-cloudops-api.md - api-credentials.md + - automation-list-roles-for-environment.md - deploy-virtual-machine-using-terraform.md - deploy-a-kubernetes-cluster-with-rancher-2-x.md