Projects

Use the Projects API to programmatically manage organizational projects and automate role assignments at scale. This is particularly useful for environments with hundreds or thousands of projects that require automated creation and rule-based governance.

List all projects

Use this query to retrieve a comprehensive list of projects, including their hierarchy and the specific automation rules applied to them.

query {
  Projects {
    nodes {
      Id
      Name
      Description
      CreationTime
      ParentFolderId
      PropagateRoleAssignment
      Rules {
        Operator
        ScopeIds
        Conditions {
          Not
          ... on ProjectRuleAzureResourceGroupNamePatternCondition {
            CaseSensitive
            NamePattern
          }
        }
      }
    }
  }
}

Sample response

{
  "data": {
    "Projects": {
      "nodes": [
        {
          "Id": "46dc694e-22e5-40a3-90d5-ce19840b731f",
          "Name": "Production Environment",
          "Description": "Main production project",
          "CreationTime": "2026-01-04T12:10:00Z",
          "ParentFolderId": "projectRoot",
          "PropagateRoleAssignment": false
        }
      ]
    }
  }
}

Create a new project with automation rules

Use the CreateProject mutation to define a project along with a sophisticated set of automation rules. These rules use And/Or operators to evaluate multiple conditions. This example demonstrates a project created with rules that filter by Azure resource group names, specific entity tags, account name patterns, and account tags.

mutation {
  CreateProject(input: {
    Description: "project description",
    Name: "project name",
    ParentFolderId: "projectRoot",
    PropagateRoleAssignment: false,
    Rules: [
      {
        ScopeIds: ["97200972-0972-0972-0972-123456789012"],
        Operator: And,
        Conditions: [
          {
            AzureResourceGroupNamePatternCondition: {
              CaseSensitive: false,
              Not: true,
              NamePattern: "*resourceGroup1*"
            }
          },
          {
            EntityTagPatternCondition: {
              TagPattern: {
                # CaseSensitive moved inside Key and Value
                Key: { 
                  Pattern: "key*",
                  CaseSensitive: false,
                  Not: false 
                },
                Value: { 
                  Pattern: "", # Pattern is required 
                  CaseSensitive: false,
                  Not: false
                }
              }
            }
          },
          {
            AccountNamePatternCondition: {
              CaseSensitive: false,
              Not: false, # Added Not which is required in Upsert request [cite: 274]
              NamePattern: "prd*"
            }
          },
          {
            AccountTagPatternCondition: {
              TagPattern: {
                Key: { 
                  CaseSensitive: false, 
                  Not: false,
                  Pattern: "key*" 
                },
                Value: { 
                  CaseSensitive: false, 
                  Not: false, 
                  Pattern: "value*" 
                }
              }
            }
          }
        ]
      }
    ]
  }) {
    Project {
      Id
    }
  }
}

Sample response

{
  "data": {
    "CreateProject": {
      "Project": {
        "Id": "14e3d558-16a7-474d-8d48-d66e295a2177"
      }
    }
  }
}

Update an existing project

Use the UpdateProject mutation to modify a project's metadata or refresh its automation rules.

mutation {
  UpdateProject(input: {
    Id: "46dc694e-22e5-40a3-90d5-ce19840b731f",
    Name: "Updated Project Name",
    Description: "New description"
  }) {
    Project {
      Id
    }
  }
}

Delete a project

Use the DeleteProject mutation to remove a project from the system. You must provide the unique Document ID of the project.

mutation {
  DeleteProject(input: {
    Id: "a25baf7a-d4b3-4d31-8d4f-80574f1cd3d1"
  }) {
    Deleted
  }
}

Sample response

{
  "data": {
    "DeleteProject": {
      "Deleted": true
    }
  }
}

Did this page help you?