-
Notifications
You must be signed in to change notification settings - Fork 0
Troubleshooting
This guide provides solutions to common issues encountered when using AzureDevOpsDscNative.
- Authentication Issues
- Resource Creation Issues
- Permission Issues
- Configuration Issues
- Performance Issues
- General DSC Issues
Symptoms:
- Error:
Unable to authenticate with Azure DevOps - Resource creation fails at authentication step
- Tests fail with authentication error
Common Causes:
- Incorrect credentials or token
- Expired token or credentials
- Insufficient permissions
- Wrong organization name
Solutions:
-
Verify credentials:
# Test PAT connectivity $pat = 'your-pat-token' $headers = @{ Authorization = 'Basic ' + [Convert]::ToBase64String([Text.Encoding]::ASCII.GetBytes(":$pat")) } $response = Invoke-RestMethod -Uri 'https://dev.azure.com/YourOrg/_apis/projects' -Headers $headers Write-Host $response.value.Count "projects found"
-
Check token expiration:
# Check when PAT expires in Azure DevOps portal # Create new token if expired
-
Verify permissions:
- User should be in appropriate groups
- PAT should have required scopes
- For service principals, check role assignments
-
Confirm organization name:
# Use exact organization name from URL # https://dev.azure.com/YourOrgName
Symptoms:
- Error:
Access deniedorInsufficient permissions - Some operations succeed, others fail
- Different errors for different resources
Solutions:
-
Check group membership:
# Verify user is in Project Collection Administrators for org-level operations # Verify user is in Project Administrators for project-level operations
-
Verify PAT scopes:
# Scopes needed (in order of commonality): # - Project & Team # - Build # - Packaging # - Release # - Service Connections # - User Profile
-
Check service principal:
# For service principals: # 1. Add to appropriate groups in Azure DevOps # 2. Assign Azure RBAC roles if using Managed Identity # 3. Verify certificate is properly configured
-
Review audit logs:
# Check Azure DevOps audit logs for denied operations # Review Azure activity logs for ARM operations
Symptoms:
- Worked previously, now fails
- Error appears after extended use
- Intermittent failures
Solutions:
-
Create new PAT:
- Go to Azure DevOps > User Settings > Personal access tokens
- Create new token with same scopes
- Update configuration with new token
-
Check token expiration:
# Check PAT expiration date when creating # Default: 1 year, can extend to custom date
-
Implement token rotation:
- Create new token before expiration
- Update configuration gradually
- Monitor for authentication failures
Symptoms:
- Error:
Resource does not existorNot found - Get method returns null
- Test method returns false
Common Causes:
- Resource hasn't been created yet
- Typo in resource name
- Resource is in different project or scope
- Resource was deleted
Solutions:
-
Verify resource exists:
# Use Azure DevOps UI to confirm resource exists # Check correct project/organization
-
Check naming:
# Names are case-insensitive for matching # But case-sensitive for display # Verify exact spelling
-
Ensure dependencies are created first:
# Check DependsOn includes required resources DependsOn = '[AzDoProject]MyProject'
-
Verify resource type:
# Confirm using correct resource name # AzDoProject (not AzDoProjects) # AzDoTeam (not AzDoTeams)
Symptoms:
- Error:
Resource already exists - Cannot create resource with same name
- Name conflicts with existing resource
Solutions:
-
Use unique name:
# Add suffix or prefix to make unique ProjectName = 'MyProject-v2'
-
Update existing resource:
# Instead of creating new, update existing Ensure = 'Present' # Will update if exists
-
Remove existing resource first:
# Create removal configuration AzDoProject 'RemoveOld' { Ensure = 'Absent' ProjectName = 'OldName' }
Symptoms:
- Error:
Invalid property value - Error:
Constraint violation - Error:
Cannot modify immutable property
Solutions:
-
Check immutable properties:
# Cannot change after creation: # - SourceControlType (Git vs Tfvc) # - ProcessTemplate (Agile, Scrum, etc.) # - Repository name (some cases) # Must delete and recreate if needed
-
Verify property values:
# Check valid values ProcessTemplate = 'Agile' # or 'Scrum', 'CMMI', 'Basic' SourceControlType = 'Git' # or 'Tfvc' Visibility = 'Private' # or 'Public'
-
Check naming conventions:
# Avoid special characters # Use alphanumeric + spaces, hyphens, underscores # Keep names reasonable length (< 255 chars)
Symptoms:
- Error:
Failed to assign permission - Permission appears not to take effect
- Different users see different permissions
Solutions:
-
Verify group exists:
# Ensure group is created before assigning permissions DependsOn = '[AzDoOrganizationGroup]GroupName'
-
Check permission name:
# Use exact permission name PermissionName = 'Create Project' # Case matters
-
Verify scope:
# Organization-level: omit ProjectName # Project-level: include ProjectName # Namespace-level: use appropriate namespace
-
Check allow/deny:
# Deny takes precedence over Allow # Inherited permissions may override # Check parent group permissions
Symptoms:
- Permission set but user still denied access
- Test shows permission exists but doesn't work
- Different behavior than expected
Solutions:
-
Check inheritance:
# Inherited permissions may be overridden # Check parent groups and scopes # May need to explicitly set instead of inherit
-
Verify user assignment:
# Ensure user is actually in the group # Use AzDoGroupMember to add to group # Check group membership in UI
-
Wait for cache refresh:
# Permissions cache may take 5-10 minutes # Try accessing resource after delay # Clear browser cache if using UI
-
Check for conflicting denies:
# Explicit deny overrides allow # Check all parent groups and scopes # Remove deny if incorrectly set
Symptoms:
- Configuration runs but makes no changes
- Test method always returns true
- Changes don't persist
Solutions:
-
Check Ensure property:
# Ensure = 'Present' by default # If missing, configuration may do nothing Ensure = 'Present'
-
Enable verbose logging:
Start-DscConfiguration -Path ./Config -Wait -Verbose -Force
-
Check DSC logs:
# View DSC event log Get-WinEvent -LogName 'DSC/Operational' | Where-Object Message -match 'Error' | Select-Object TimeCreated, Message
-
Verify authentication:
# Ensure auth is properly set # Check token/credentials are valid # Verify access to required resources
Symptoms:
- Some properties change, others don't
- Test method indicates resource matches
- Manual changes revert
Solutions:
-
Check property support:
# Some properties may be read-only # SourceControlType cannot be changed after creation # May need to delete and recreate
-
Use Set method explicitly:
$properties = @{ ProjectName = 'MyProject' ProjectDescription = 'New description' } Invoke-DscResource -Name 'AzDoProject' ` -Method Set ` -Property $properties
-
Force reapplication:
# Remove LCM cache Remove-Item C:\Windows\System32\config\systemprofile\AppData\Local\` dsc\configuration -Recurse -Force Start-DscConfiguration -Path ./Config -Force -Wait -Verbose
Symptoms:
- Configuration takes unusually long time
- API calls time out
- Memory usage increases
Solutions:
-
Batch similar operations:
# Create multiple resources of same type together foreach ($project in $projectList) { AzDoProject "Project_$($project.Name)" { ProjectName = $project.Name # ... } }
-
Reduce API calls:
# Combine operations where possible # Avoid redundant Get operations # Cache organizational data
-
Use parallel execution:
# Independent resources can run in parallel # DSC automatically parallelizes when possible # Ensure proper DependsOn for ordering
-
Increase timeouts:
# Some operations may need more time # Check Azure DevOps load # Consider throttling rate limits
Symptoms:
- Error:
Rate limit exceeded - Error:
Too many requests - API calls start failing
Solutions:
-
Reduce concurrency:
# Azure DevOps has API rate limits # Add delays between operations # Use sequential instead of parallel
-
Implement backoff:
# Wait before retrying failed operations # Start small (1 second), exponential backoff # Max reasonable wait (1-5 minutes)
-
Request quota increase:
# Contact Microsoft for higher limits # Enterprise agreements may have higher limits # Monitor usage patterns
Symptoms:
- Configuration fails to run
- Compilation errors
- Resource not found
Solutions:
-
Verify module is imported:
Import-DscResource -ModuleName 'AzureDevOpsDscNative' # Check module is installed Get-Module AzureDevOpsDscNative -ListAvailable
-
Check PowerShell version:
# Requires PowerShell 7.0+ $PSVersionTable.PSVersion
-
Clear DSC cache:
# Remove cached configurations Remove-Item C:\Windows\System32\config\systemprofile\` AppData\Local\dsc\configuration -Recurse -Force
-
Review syntax:
# Check configuration syntax # Verify all properties are valid # Check for typos in resource names
Symptoms:
- Get returns error
- Test method throws exception
- Set method fails silently
Solutions:
-
Enable debug output:
$DebugPreference = 'Continue' Invoke-DscResource -Name 'AzDoProject' -Method Get -Property @{ProjectName='Test'}
-
Check prerequisites:
# Verify all dependencies are met # Check required modules are installed # Ensure authentication is working
-
Test with Invoke-DscResource:
# Test individual resource Invoke-DscResource -Name 'AzDoProject' ` -Method Test ` -Property @{ProjectName='Test'; Ensure='Present'} ` -ModuleName 'AzureDevOpsDscNative'
If you can't find solution here:
- Check resource documentation: See Resources for specific resource help
- Review examples: Look for similar scenario in Examples
- Check Best Practices: See Best Practices for patterns
- Enable logging: Use verbose/debug output for more details
- Check Azure DevOps status: Verify service isn't having issues
- Report issue: File issue on GitHub with configuration and error details
Common Errors:
-
404 Not Found- Resource doesn't exist -
403 Forbidden- Insufficient permissions -
401 Unauthorized- Authentication failed -
409 Conflict- Resource name conflict -
400 Bad Request- Invalid property value -
429 Too Many Requests- Rate limit exceeded -
500 Server Error- Azure DevOps service issue
Quick Fixes:
- Check authentication first
- Verify resource exists
- Confirm permissions
- Check property values
- Review dependencies
- Enable verbose logging
- Check Azure DevOps status
- Try again after delay