Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deploy-policyplan.ps1 seems to be removing spaces from during policy assignments #129

Closed
artisticcheese opened this issue Jan 24, 2023 · 10 comments
Labels
bug Something isn't working duplicate This issue or pull request already exists question Further information is requested

Comments

@artisticcheese
Copy link
Contributor

My assignment file is below and here is how actual assignment looks like

{
   // Modify Policies for required tags --- use this comment to trigger deployment
   "nodeName": "/Tags/",
   "parameters": {},
   "children": [
      {
         "nodeName": "required-and-inherit/",
         "scope": {
            "epac-dev": [
               "/providers/Microsoft.Management/managementGroups/EPAC-Dev"
            ],
            "dev-environment": [
               "/providers/Microsoft.Management/managementGroups/DevOps-mg"
            ],
            "prod-environment": [
               "/providers/Microsoft.Management/managementGroups/DevOps-mg"
            ]
         },
         "definitionEntryList": [
            {
               "initiativeName": "31fa76b5-77f6-4dda-b061-324aced74fdc",
               "assignment": {
                  "name": "tagassignment",
                  "displayName": "Require Tags Assignment",
                  "description": "Assignment for all tags"
               }
            }
         ]
      }
   ]
}

image

@techlake
Copy link
Contributor

This is a bug in Az Module 9.2.x. It is fixed in Az Module. 9.3.0: see Azure/azure-powershell#20407. Make sure your environment is updated accordingly.

@artisticcheese
Copy link
Contributor Author

@artisticcheese
Copy link
Contributor Author

Solution for hosted agents to add Az update job before deployment steps for now

                - task: AzurePowerShell@5
                  name: updateAzVersion
                  displayName: Update Az Version
                  inputs:
                    azureSubscription: $(tenant2DeployServiceConnection)
                    pwsh: true
                    azurePowerShellVersion: LatestVersion
                    ScriptType: "InlineScript"
                    Inline: "Install-Module Az -Force; Get-InstalledModule Az;"

@techlake
Copy link
Contributor

Thank you for that update. Microsoft is rolling out 9.3.0. About 50% of time, you get 9.2.0 or 9.3.0. I would GUESS that in a couple of days the problem disappears. Let's leave this issue open (I reopened it) until next week (I'll close it).

1 similar comment
@techlake
Copy link
Contributor

techlake commented Jan 24, 2023

Thank you for that update. Microsoft is rolling out 9.3.0. About 50% of time, you get 9.2.0 or 9.3.0. I would GUESS that in a couple of days the problem disappears. Let's leave this issue open (I reopened it) until next week (I'll close it).

@techlake techlake reopened this Jan 24, 2023
@techlake techlake added question Further information is requested bug Something isn't working labels Jan 24, 2023
@artisticcheese
Copy link
Contributor Author

Thank you for that update. Microsoft is rolling out 9.3.0. About 50% of time, you get 9.2.0 or 9.3.0. I would GUESS that in a couple of days the problem disappears. Let's leave this issue open (I reopened it) until next week (I'll close it).

Official Microsoft documentation states that latest version of hosted agent contains 9.2.0, are you seeing 9.3.0 on hosted agents?

@techlake
Copy link
Contributor

Yes, I am seeing it intermittent as shown in this log snippet:

Generating script.
Formatted command: . '/home/vsts/work/1/s/Scripts/Deploy/Build-DeploymentPlans.ps1' -pacEnvironmentSelector epac-dev ` -devOpsType "ado" ` -InformationAction Continue
/usr/bin/pwsh -NoLogo -NoProfile -NonInteractive -ExecutionPolicy Unrestricted -Command . '/home/vsts/work/_temp/89bd46b6-57d7-4d0b-bb2a-b6b572c39062.ps1'
Saved!
Import-Module -Name /usr/share/**az_9.3.0**/Az.Accounts/2.11.1/Az.Accounts.psd1 -Global

This repo builds the agent images. For Linux, this file drives the version:

    "azureModules": [
        {
            "name": "az",
            "url" : "https://raw.githubusercontent.com/Azure/az-ps-module-versions/main/versions-manifest.json",
            "versions": [
                "9.3.0"
            ],
            "zip_versions": [
            ]
        }
    ],

@techlake
Copy link
Contributor

It appears that the Microsoft hosted agents have been fully upgraded to the required 9.3.0

@artisticcheese
Copy link
Contributor Author

Yes, readme reflects it as well

@techlake techlake added the duplicate This issue or pull request already exists label Jan 26, 2023
@techlake
Copy link
Contributor

I'll close it as resolved

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working duplicate This issue or pull request already exists question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants