Last active
September 7, 2025 20:28
-
-
Save riosengineer/e129cfd978e5638c7a939e63fd2bf02c to your computer and use it in GitHub Desktop.
Azure Roles AzDo Automatic Pipline
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Azure DevOps Pipeline to update Azure roles nightly | |
| # Runs the create-azureroles.ps1 script to check for new Azure roles and create PRs | |
| trigger: none # Disable CI triggers since this runs on schedule | |
| schedules: | |
| - cron: "0 0 * * *" # Run at midnight UTC every night | |
| displayName: 'Nightly Azure Roles Update' | |
| branches: | |
| include: | |
| - main | |
| always: 'true' # Run even if there are no code changes | |
| pool: | |
| vmImage: 'ubuntu-latest' | |
| variables: | |
| # Service connection name - update this to match your Azure service connection | |
| azureServiceConnection: '' | |
| # Azure tenant ID from service connection - predefined var for fed credentials | |
| AZURE_TENANT_ID: $(tenantId) | |
| # Azure client ID from service connection - as above | |
| AZURE_CLIENT_ID: $(servicePrincipalId) | |
| # Azure DevOps authentication - predefined var, no need to edit | |
| AZURE_DEVOPS_EXT_PAT: $(System.AccessToken) | |
| jobs: | |
| - job: UpdateAzureRoles | |
| displayName: 'Update Azure Roles' | |
| steps: | |
| - checkout: self | |
| persistCredentials: 'true' # Allow git operations | |
| - task: PowerShell@2 | |
| displayName: 'Configure Git Authentication' | |
| inputs: | |
| targetType: 'inline' | |
| script: | | |
| # Configure git user settings only | |
| git config --global user.email "dan@rios.engineer" | |
| git config --global user.name "Dan Rios" | |
| - task: AzureCLI@2 | |
| displayName: 'Configure Azure DevOps CLI' | |
| inputs: | |
| azureSubscription: $(azureServiceConnection) | |
| scriptType: 'bash' | |
| scriptLocation: 'inlineScript' | |
| inlineScript: | | |
| # Configure Azure DevOps CLI for this organization and project | |
| az devops configure --defaults organization=$(System.TeamFoundationCollectionUri) project=$(System.TeamProject) | |
| - task: AzurePowerShell@5 | |
| displayName: 'Run Azure Roles Update Script' | |
| inputs: | |
| azureSubscription: $(azureServiceConnection) | |
| ScriptType: 'FilePath' | |
| ScriptPath: '$(Build.SourcesDirectory)/create-azureroles.ps1' | |
| workingDirectory: '$(Build.SourcesDirectory)' | |
| azurePowerShellVersion: 'LatestVersion' | |
| env: | |
| # Azure authentication variables | |
| AZURE_TENANT_ID: $(AZURE_TENANT_ID) | |
| AZURE_CLIENT_ID: $(AZURE_CLIENT_ID) | |
| # Azure DevOps CLI authentication for PR creation | |
| AZURE_DEVOPS_EXT_PAT: $(System.AccessToken) | |
| # Git authentication token | |
| SYSTEM_ACCESSTOKEN: $(System.AccessToken) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment