Help Center> IoT Device Access> User Guide> Permissions Management> Creating a Custom IoTDA Policy

Creating a Custom IoTDA Policy

Custom policies can be created to supplement system-defined policies. For the actions supported for custom policies, see Common operations supported by each system role and system-defined policy of IoTDA.

You can create custom policies in either of the following ways:

  • Visual editor: Select cloud services, actions, resources, and request conditions. This does not require knowledge of policy syntax.
  • JSON: Edit JSON policies from scratch or based on an existing policy.

For details, see Creating a Custom Policy. The following section illustrates common custom IoTDA policies.

Example Custom IoTDA Policies

  • Example 1: Allowing users to register and query devices

    {
        "Version": "1.1",
        "Statement": [
            {
                "Effect": "Allow",
                "Action": [
                         "iotda:devices:query",
                         "iotda:devices:register"
                ]
            }
        ]
    }
  • Example 2: Denying device deletion

    A policy with only Deny permissions must be used in conjunction with other policies to take effect. If both Allow and Deny permissions are assigned to a user, the Deny permissions take precedence over the Allow permissions.

    The following method can be used if you need to assign permissions of the IoTDA FullAccess policy to a user but you want to prevent the user from deleting instances. Create a custom policy for denying instance deletion, and attach both policies to the group to which the user belongs. Then, the user can perform all operations on IoTDA except deleting instances. The following is an example of a deny policy:
    {
            "Version": "1.1",
            "Statement": [
                    {
                            "Effect": "Deny",
                            "Action": [
                                    "iotda:devices:delete"
                            ]
                    }
            ]
    }
  • Example 3: Creating custom policies in the visual editor
    1. Log in to the IAM console, choose Permissions in the navigation pane, and click Create Custom Policy in the upper right corner.

    2. Set the parameters based on the following table and click OK.

      Parameter

      Description

      Policy Name

      Customize the value.

      Scope

      Select Project-level services if the service to which the policy is related must be deployed in a specific region.

      Policy View

      Select Visual editor.

      Policy Content

      Set the policy content.

      • Select Allow.
      • Select IoTDA for Service.
      • Select actions.
      • Resource is not supported currently.
      • Request condition is not supported currently.

      Description

      Enter a brief description for the policy. This parameter is optional.