Skip to content

Add Power BI Capacity Management with Automated Scheduling#46

Draft
Copilot wants to merge 7 commits intodevfrom
copilot/fix-32
Draft

Add Power BI Capacity Management with Automated Scheduling#46
Copilot wants to merge 7 commits intodevfrom
copilot/fix-32

Conversation

Copy link
Contributor

Copilot AI commented Jul 7, 2025

This PR implements comprehensive Power BI capacity management capabilities including manual pause/start controls and automated rule-based scheduling.

Features Added

🎛️ Manual Capacity Control

  • Real-time status display showing capacity state (Running/Paused/Unknown), name, region, and SKU
  • One-click pause/start buttons for immediate capacity control
  • Status refresh to get current capacity information on demand

⏰ Automated Rule-Based Scheduling

  • Time-based rules for automated capacity start/stop operations
  • Daily schedule configuration with timezone support
  • Rule management interface to create, edit, enable/disable, and delete rules
  • Background scheduler task that evaluates rules every 5 minutes

🔧 Azure Management API Integration

  • Secure credential storage for Azure Management API access
  • Azure subscription, resource group, and capacity configuration
  • Service principal authentication for automated operations
  • Comprehensive error handling and logging

🖥️ Admin Interface

  • New "Capacity Management" tab in the PersonaBar admin interface
  • Intuitive rule creation wizard with form validation
  • Visual status indicators and action buttons
  • Integrated settings for Azure Management API credentials

Technical Implementation

// Example: Creating a capacity rule
var rule = new CapacityRule
{
    RuleName = "Business Hours Start",
    Action = "Start", 
    ExecutionTime = TimeSpan.Parse("08:00"),
    DaysOfWeek = "1,2,3,4,5", // Monday-Friday
    TimeZoneId = "Eastern Standard Time",
    IsEnabled = true
};

Architecture Components

  • Data Layer: New CapacityRule model with repository pattern
  • Service Layer: CapacityManagementService for Azure API integration
  • Scheduling: CapacityRuleTask runs as DNN scheduled task
  • API Layer: CapacityManagementController with REST endpoints
  • UI Layer: React components with Redux state management

Database Changes

  • Added PBI_CapacityRules table for rule storage
  • Extended PBI_Settings with Azure Management API credentials
  • Proper foreign key relationships and constraints
  • Upgrade script 01.03.02.SqlDataProvider handles schema changes

Security & Configuration

  • Role-based access control using DNN security model
  • Encrypted storage of Azure client secrets
  • Input validation and SQL injection protection
  • Comprehensive audit logging

Usage Example

Administrators can now:

  1. Configure Azure credentials in workspace settings
  2. View real-time capacity status in the admin panel
  3. Create scheduling rules like "Start at 8 AM, Stop at 6 PM on weekdays"
  4. Monitor rule execution through DNN scheduler logs
  5. Manually override capacity state when needed

The implementation seamlessly integrates with existing PowerBI module functionality while adding powerful new automation capabilities for cost optimization.

Fixes #32.


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI and others added 2 commits July 7, 2025 11:28
… components

Co-authored-by: davidjrh <489976+davidjrh@users.noreply.github.com>
… files, and documentation

Co-authored-by: davidjrh <489976+davidjrh@users.noreply.github.com>
Copilot AI changed the title [WIP] Add the ability to pause/start the capacity Add Power BI Capacity Management with Automated Scheduling Jul 7, 2025
Copilot AI requested a review from davidjrh July 7, 2025 11:36
@BorjaUmpierrezMayor BorjaUmpierrezMayor changed the base branch from master to dev November 3, 2025 07:59
@BorjaUmpierrezMayor BorjaUmpierrezMayor self-assigned this Nov 3, 2025
BorjaUmpierrezMayor and others added 4 commits November 10, 2025 11:01
General.
- Compilation errors resolved.
- Translations were not loading correctly and were incomplete.

Controller.
- Fixed routing of ‘CapacityManagementController’ because RouteMap points to the .Service module and not .Controller.
- The ‘CapacityManagement’ controller did not support the ‘Master User’ option.
- Conversion to CapcityState removed to avoid errors when returning information.
- CapacityRules data was not being saved.

SQL.
- Fixed errors in SQL calls.
- Modified the SQL Provider and dnn manifest.

UI.
- Fixed duplicates in the page view.
- Improved UI and usability.
- Added configurable polling when starting or stopping the instance.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add the ability to pause/start the capacity

3 participants