Managing cloud access policies
Note
This feature is in the Preview stage. To get access, contact tech support
Access policies are a Yandex Identity and Access Management mechanism that allows you to manage permissions for specific operations with Yandex Cloud resources. Access policies complement the role system for more flexible access management.
The cloud access policies can be managed by users with the resource-manager.admin or admin role for the cloud.
Assigning an access policy for a cloud
To assign an access policy for a cloud, follow these steps:
If you do not have the Yandex Cloud CLI installed yet, install and initialize it.
-
Get a list of supported access policies with their IDs.
-
Run this command:
yc resource-manager cloud bind-access-policy \ --name <cloud_name> \ --access-policy-template-id=<access_policy_ID>Where:
--name: Name of the cloud you want to assign the access policy for. Instead of the cloud name, you can provide its ID in the--idparameter.--access-policy-template-id: ID of the access policy you want to assign for the cloud.
-
Make sure the policy was assigned.
Use the bindAccessPolicy REST API method for the Cloud resource or the CloudService/BindAccessPolicy gRPC API call.
The assigned access policy will apply to resources within all folders in the specified cloud.
Viewing the list of access policies assigned for a cloud
To view the list of access policies assigned for a cloud:
If you do not have the Yandex Cloud CLI installed yet, install and initialize it.
Run the command, specifying the name or ID of the cloud for which you want to view the assigned policies:
yc resource-manager cloud list-access-policy-bindings <cloud_name_or_ID>
Result:
+---------------------------------------+
| ACCESS POLICY TEMPLATE ID |
+---------------------------------------+
| iam.denyServiceAccountApiKeysCreation |
+---------------------------------------+
Use the listAccessPolicyBindings REST API method for the Cloud resource or the CloudService/ListAccessPolicyBindings gRPC API call.
Revoking an access policy assigned for a cloud
To revoke an access policy assigned for a cloud:
If you do not have the Yandex Cloud CLI installed yet, install and initialize it.
-
Get a list of access policy IDs assigned for the cloud.
-
Run this command:
yc resource-manager cloud unbind-access-policy \ --name <cloud_name> \ --access-policy-template-id=<access_policy_ID>Where:
--name: Name of the cloud you want to revoke the policy from. Instead of the cloud name, you can provide its ID in the--idparameter.--access-policy-template-id: ID of the access policy you want to revoke from the specified cloud.
-
Make sure the policy has been revoked.
Use the unbindAccessPolicy REST API method for the Cloud resource or the CloudService/UnbindAccessPolicy gRPC API call.
The specified access policy will no longer apply to resources within all folders in the given cloud.