chore: exclude legacy infra/old/ from PSRule validation#2
Draft
chore: exclude legacy infra/old/ from PSRule validation#2
Conversation
Updated the workflow to deploy Azure resources instead of validating templates. Added steps for Azure login and provisioning.
Updated the Azure workflow for deployment, replacing template validation with deployment steps and adding Azure login and provisioning commands.
…tion chore: Update Azure workflow for deployment and add template validation
…lidation Agent-Logs-Url: https://github.com/Pavan-Microsoft/Multi-Agent-Custom-Automation-Engine-Solution-Accelerator/sessions/e65a1d7c-3a2a-4e1a-bd26-faecec0eec6e Co-authored-by: Pavan-Microsoft <173439362+Pavan-Microsoft@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Add PSRule exclusion for legacy Bicep files
chore: exclude legacy infra/old/ from PSRule validation
Mar 30, 2026
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
PSRule was scanning legacy Bicep files under
infra/old/during AZD Template Validation, causing CI failures due to unresolvable compilation errors (BCP091,BCP062,BCP029,BCP134) from moved/deleted file references and invalid declarations.Changes
.ps-rule/ps-rule.yaml(new file): Creates PSRule configuration excludinginfra/old/**from input path scanningOriginal prompt
The AZD Template Validation workflow is failing (see failing job) due to Bicep compilation errors in legacy files under
infra/old/.Errors
PSRule is picking up old/legacy Bicep files under
infra/old/00-older/andinfra/old/08-2025/that have multiple compilation errors:aiFoundryAiHub,containerAppEnvironment,entraIdApplication)subscriptionis not valid for the moduleSolution
Create a new file
.ps-rule/ps-rule.yaml(the.ps-rule/directory does not currently exist in the repo) with the following content to exclude the legacyinfra/old/directory from PSRule validation:This will tell PSRule to skip all files under
infra/old/during Bicep compilation and rule evaluation, eliminating the legacy Bicep errors.The following is the prior conversation context from the user's chat exploration (may be truncated):
User: Please find a solution for this failing job. Use the logs, job definition, and any referenced files where the failure occurred. Keep your response focused on the solution and include code suggestions when appropriate.
Assistant:
I'll start by fetching the job logs and the workflow definition to understand the failure.
Assistant: Let me examine the workflow file and the relevant Bicep files to understand the full picture.
Assistant:
Failing Job Analysis: AZD Template Validation
The job has three distinct failures. Here's a breakdown and solution for each:
1. Bicep Compilation Errors in
infra/old/DirectoryThe PSRule validation is picking up old/legacy Bicep files under
infra/old/00-older/andinfra/old/08-2025/that have multiple issues:aiFoundryAiHub,containerAppEnvironment,entraIdApplication)subscriptionis not valid for the moduleSolution: Exclude the
infra/old/directory from validation. You can do this by adding a.ps-rule/ps-rule.yamlconfiguration file (or updating it if it exists) to exclude those paths:Alternatively, if these old Bicep files are no longer needed, delete the
infra/old/directory entirely.2. PSRule Failure:
Azure.AppService.ManagedIdentity(AZR-000082)The resource
app-macaeebfc4(aMicrosoft.Web/sitesresource) is failing because it does not have a managed identity configured.Solution: In your main Bicep template where the App Service is defined, add the
identityproperty to enable a system-assigned managed identity:If you're already using a user-assigned managed identity, make sure it's being passed correctly in the test Bicep file. If this rule should be suppressed for the test environment, you can add a suppression in
.ps-rule/ps-rule.yaml:3. Shell Script Syntax Error in Post-Validation Step
The log shows:
This occurs in a step that runs
if [ -f "./infra/main.bicep" ]; then. The error suggests a quoting or syntax issue in how the shell command is being constructed. This is likely coming from themicrosoft/template-validation-action@v0.4.3itself, and may be triggered by an environment variable containing special characters or being empty.This is a secondary failure (runs after the primary PSRule failure), so fixing issues #1 and #2 above should be the priority.
Recommended Fix (Priority Order)
infra/old/— This eliminates all the legacy Bicep compilation errors.AZR-000082), which is the primary blocker causing the job to exit with code 1.After these two changes, the validation should pass with 88/88 rules succeeding.
User: give full filewith for pathIgnore:
- 'infra/old/**'
Assistant:
Let me check if a
.ps-rule/ps-rule.yamlfile already exists in the repository.Assistant: The `.p...
This pull request was created from Copilot chat.