MSDN Documentation

App Services

Managing Users in App Services

This document provides a comprehensive guide to managing users within your Microsoft App Services environment. Effective user management is crucial for security, access control, and operational efficiency.

User Roles and Permissions

App Services supports a granular role-based access control (RBAC) system. Understanding these roles is the first step to managing users effectively.

Built-in Roles

Custom Roles

For more specific needs, you can create custom roles with precisely defined permissions tailored to your organizational structure and security policies.

Adding and Removing Users

You can manage users and their role assignments directly through the Azure portal or programmatically using the Azure CLI or Azure PowerShell.

Using the Azure Portal

  1. Navigate to your App Service resource in the Azure portal.
  2. In the left-hand menu, select Access control (IAM).
  3. Click on + Add and choose Add role assignment.
  4. Select the desired role, then click Members.
  5. Click + Select members to add users, groups, or service principals.
  6. To remove a user, select their name in the list, click Remove, and confirm the action.

Using Azure CLI

To add a user with the Contributor role to a resource group:

az role assignment create --role "Contributor" --assignee "user@example.com" --resource-group "MyResourceGroup"

To remove a role assignment:

az role assignment delete --assignee "user@example.com" --role "Contributor" --resource-group "MyResourceGroup"

Best Practices for User Management

Tip: Regularly review user access and permissions. Remove access for users who no longer require it to maintain a strong security posture.

API Reference for User Management

Operation Description HTTP Method Endpoint
List Role Assignments Retrieves all role assignments for a scope. GET /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Authorization/roleAssignments
Create Role Assignment Creates a new role assignment. PUT /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Authorization/roleAssignments/{roleAssignmentName}
Delete Role Assignment Deletes a role assignment. DELETE /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Authorization/roleAssignments/{roleAssignmentName}
Important: When creating role assignments programmatically, ensure you have the necessary permissions and use service principals for automated tasks.

Troubleshooting Common Issues

Issue: User cannot access App Service resources.

Solution: Verify that the user has been assigned the correct role with appropriate permissions for the specific resource or scope. Check for any conflicting deny assignments.

Issue: Accidental deletion of a user role assignment.

Solution: Use Azure Activity Logs to identify when the assignment was deleted and who performed the action. Recreate the assignment as needed. Consider implementing Azure Policy to prevent accidental deletions of critical role assignments.