Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,11 @@ const (

// AI-specific roles that grant agent management access.
roleAzureAIDeveloper = "64702f94-c441-49e6-a78b-ef80e0188fee"

// Cognitive Services User: backward-compat alias for Foundry User.
// Assigned by older Bicep provisions (AZURE_PRINCIPAL_ID flow); has the same
// Microsoft.CognitiveServices/* dataActions as Foundry User and is accepted as equivalent.
roleCognitiveServicesUser = "a97b65f3-24c7-4388-baec-2e87135dc908"
)

// sufficientACRRoles lists every role that grants enough ACR access to build
Expand All @@ -66,13 +71,17 @@ var sufficientACRAbacRoles = []string{
roleContainerRegistryRepositoryContributor, // superset of RepositoryWriter
}

// sufficientAIUserRoles lists every role that grants enough Foundry Project
// access to create and run agents.
// sufficientAIUserRoles lists roles whose dataActions cover Microsoft.CognitiveServices/*,
// specifically the AIServices namespace required for Foundry agents (agents/write).
Comment thread
jayzhang marked this conversation as resolved.
//
// Excluded intentionally:
// - roleOwner / roleContributor: management-plane only, zero dataActions
// - roleAzureAIDeveloper: dataActions cover only OpenAI/Speech/ContentSafety/MaaS,
// NOT the AIServices.* namespace used by Foundry agents; Azure docs state
// "For Foundry project access, use the Foundry User or Foundry Owner roles instead"
var sufficientAIUserRoles = []string{
roleOwner,
roleContributor,
roleAzureAIUser,
roleAzureAIDeveloper,
roleAzureAIUser, // 53ca6127-... Foundry User: dataActions Microsoft.CognitiveServices/*
roleCognitiveServicesUser, // a97b65f3-... backward compat: same dataActions, assigned by older Bicep
Comment thread
jayzhang marked this conversation as resolved.
}

// sufficientRoleAssignWriteRoles lists every role that grants
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ func TestDeveloperRBACRoleConstants(t *testing.T) {

// AI roles
assert.Equal(t, "64702f94-c441-49e6-a78b-ef80e0188fee", roleAzureAIDeveloper)
assert.Equal(t, "a97b65f3-24c7-4388-baec-2e87135dc908", roleCognitiveServicesUser)
}

func TestSufficientRoleLists(t *testing.T) {
Expand All @@ -61,10 +62,14 @@ func TestSufficientRoleLists(t *testing.T) {
assert.Contains(t, sufficientACRRoles, roleContainerRegistryTasksContributor)
assert.Contains(t, sufficientACRRoles, roleContainerRegistryRepositoryContributor)

assert.Contains(t, sufficientAIUserRoles, roleOwner)
assert.Contains(t, sufficientAIUserRoles, roleContributor)
assert.Contains(t, sufficientAIUserRoles, roleAzureAIUser)
assert.Contains(t, sufficientAIUserRoles, roleAzureAIDeveloper)
// sufficientAIUserRoles must contain only roles whose dataActions cover AIServices.*
assert.Contains(t, sufficientAIUserRoles, roleAzureAIUser) // Foundry User: CogSvc.*
assert.Contains(t, sufficientAIUserRoles, roleCognitiveServicesUser) // backward compat: CogSvc.*
// Owner/Contributor have no dataActions and must NOT be treated as sufficient
assert.NotContains(t, sufficientAIUserRoles, roleOwner)
assert.NotContains(t, sufficientAIUserRoles, roleContributor)
// Azure AI Developer only covers OpenAI/Speech/ContentSafety/MaaS — NOT AIServices.*
assert.NotContains(t, sufficientAIUserRoles, roleAzureAIDeveloper)

// Role-assignment write: Owner, UAA, RBAC Admin, Foundry Project Manager, Foundry Account Owner;
// Contributor must NOT be included.
Expand Down
Loading