From 21493eea1271dff44fe07dbde956522e0509291c Mon Sep 17 00:00:00 2001 From: Gurpreet Singh Date: Tue, 14 Nov 2023 18:06:58 -0500 Subject: [PATCH] update --- .../workflows/sign-scripts-development.yml | 94 +++++++++++-------- 1 file changed, 54 insertions(+), 40 deletions(-) diff --git a/.github/workflows/sign-scripts-development.yml b/.github/workflows/sign-scripts-development.yml index 9ccf1caa..dabf9d13 100644 --- a/.github/workflows/sign-scripts-development.yml +++ b/.github/workflows/sign-scripts-development.yml @@ -164,54 +164,61 @@ jobs: continue-on-error: true with: inlineScript: | - ipmo ./src/GuardrailsSolutionAcceleratorSetup + ipmo ./src/GuardrailsSolutionAcceleratorSetup + + $configFilePath = Join-Path -Path $env:GITHUB_WORKSPACE -ChildPath 'config.json' + $CBSSUBSCRIPTION_NAME = $env:CBSSUBSCRIPTION_NAME + $TESTSUBSCRIPTION_ID = $env:TESTSUBSCRIPTION_ID + $LIGHTHOUSEPROVIDER_TENANTID = $env:LIGHTHOUSEPROVIDER_TENANTID + $LIGHTHOUSEPROVIDER_PRINCIPALID = $env:LIGHTHOUSEPROVIDER_PRINCIPALID + $LIGHTHOUSEPROVIDER_MGMTGRPID = $env:LIGHTHOUSEPROVIDER_MGMTGRPID + $UNIQUENAME_SUFFIX = $env:UNIQUENAME_SUFFIX - $configFilePath = Join-Path -Path $env:GITHUB_WORKSPACE -ChildPath 'config.json' - $configContent = @' - { + $configContent = @' + { "keyVaultName": "gsapipe", "resourcegroup": "gsapipe", "region": "CanadaCentral", "storageaccountName": "gsapipe", "logAnalyticsworkspaceName": "gsapipe", "autoMationAccountName": "gsapipe", - "FirstBreakGlassAccountUPN": "cspm.alpha@163gccspm.onmicrosoft.com", - "SecondBreakGlassAccountUPN": "cspm.bravo@163gccspm.onmicrosoft.com", + "FirstBreakGlassAccountUPN": "cspm.alpha@163gccspm.onmicrosoft.com", + "SecondBreakGlassAccountUPN": "cspm.bravo@163gccspm.onmicrosoft.com", "PBMMPolicyID": "4c4a5f27-de81-430b-b4e5-9cbd50595a87", "AllowedLocationPolicyId": "e56962a6-4747-49cd-b67b-bf8b01975c4c", "DepartmentNumber": "163", - "CBSSubscriptionName": $env:CBSSUBSCRIPTION_NAME, - "SecurityLAWResourceId": "/subscriptions/" + $env:TESTSUBSCRIPTION_ID + "/resourceGroups/rg-core/providers/Microsoft.OperationalInsights/workspaces/mtb-law01", - "HealthLAWResourceId": "/subscriptions/" + $env:TESTSUBSCRIPTION_ID + "/resourceGroups/rg-core/providers/Microsoft.OperationalInsights/workspaces/mtb-law01", + "CBSSubscriptionName": "$CBSSUBSCRIPTION_NAME", + "SecurityLAWResourceId": "/subscriptions/$TESTSUBSCRIPTION_ID/resourceGroups/rg-core/providers/Microsoft.OperationalInsights/workspaces/mtb-law01", + "HealthLAWResourceId": "/subscriptions/$TESTSUBSCRIPTION_ID/resourceGroups/rg-core/providers/Microsoft.OperationalInsights/workspaces/mtb-law01", "Locale": "en-CA", - "lighthouseServiceProviderTenantID": $env:LIGHTHOUSEPROVIDER_TENANTID, + "lighthouseServiceProviderTenantID": "$LIGHTHOUSEPROVIDER_TENANTID", "lighthousePrincipalDisplayName": "SSC CSPM TEAM", - "lighthousePrincipalId": $env:LIGHTHOUSEPROVIDER_PRINCIPALID, - "lighthouseTargetManagementGroupID": $env:LIGHTHOUSEPROVIDER_MGMTGRPID, - "subscriptionId": $env:TESTSUBSCRIPTION_ID, + "lighthousePrincipalId": "$LIGHTHOUSEPROVIDER_PRINCIPALID", + "lighthouseTargetManagementGroupID": "$LIGHTHOUSEPROVIDER_MGMTGRPID", + "subscriptionId": $TESTSUBSCRIPTION_ID, "SSCReadOnlyServicePrincipalNameAPPID": "00000000-0000-0000-0000-000000000000", - "uniqueNameSuffix": $env:UNIQUENAME_SUFFIX, + "uniqueNameSuffix": $UNIQUENAME_SUFFIX, "securityRetentionDays": "730", "cloudUsageProfiles": "1,2" } - '@ - Set-Content -Path $configFilePath -Value $configContent + '@ + Set-Content -Path $configFilePath -Value $configContent - Push-Location -Path setup + Push-Location -Path setup - try { - $ErrorActionPreference = 'Stop' - remove-gsacentralizedReportingCustomerComponents -Force -configFilePath $configFilePath - Remove-GSACentralizedDefenderCustomerComponents -Force -configFilePath $configFilePath - Remove-GSACoreResources -Force -Wait -configFilePath $configFilePath - } - catch { - throw "Failed test deploy of solution with error: $_" - } - finally { - If (!$?) {throw "Failed test deploy of solution with error: $($error[0]) $_"} - Pop-Location - } + try { + $ErrorActionPreference = 'Stop' + remove-gsacentralizedReportingCustomerComponents -Force -configFilePath $configFilePath + Remove-GSACentralizedDefenderCustomerComponents -Force -configFilePath $configFilePath + Remove-GSACoreResources -Force -Wait -configFilePath $configFilePath + } + catch { + throw "Failed test deploy of solution with error: $_" + } + finally { + If (!$?) {throw "Failed test deploy of solution with error: $($error[0]) $_"} + Pop-Location + } azPSVersion: "latest" env: TESTTENANT_DOMAIN: ${{ vars.TESTTENANT_DOMAIN }} @@ -226,6 +233,13 @@ jobs: with: inlineScript: | $configFilePath = Join-Path -Path $env:GITHUB_WORKSPACE -ChildPath 'config.json' + $CBSSUBSCRIPTION_NAME = $env:CBSSUBSCRIPTION_NAME + $TESTSUBSCRIPTION_ID = $env:TESTSUBSCRIPTION_ID + $LIGHTHOUSEPROVIDER_TENANTID = $env:LIGHTHOUSEPROVIDER_TENANTID + $LIGHTHOUSEPROVIDER_PRINCIPALID = $env:LIGHTHOUSEPROVIDER_PRINCIPALID + $LIGHTHOUSEPROVIDER_MGMTGRPID = $env:LIGHTHOUSEPROVIDER_MGMTGRPID + $UNIQUENAME_SUFFIX = $env:UNIQUENAME_SUFFIX + $configContent = @' { "keyVaultName": "gsapipe", @@ -234,22 +248,22 @@ jobs: "storageaccountName": "gsapipe", "logAnalyticsworkspaceName": "gsapipe", "autoMationAccountName": "gsapipe", - "FirstBreakGlassAccountUPN": "cspm.alpha@163gccspm.onmicrosoft.com", - "SecondBreakGlassAccountUPN": "cspm.bravo@163gccspm.onmicrosoft.com", + "FirstBreakGlassAccountUPN": "cspm.alpha@163gccspm.onmicrosoft.com", + "SecondBreakGlassAccountUPN": "cspm.bravo@163gccspm.onmicrosoft.com", "PBMMPolicyID": "4c4a5f27-de81-430b-b4e5-9cbd50595a87", "AllowedLocationPolicyId": "e56962a6-4747-49cd-b67b-bf8b01975c4c", "DepartmentNumber": "163", - "CBSSubscriptionName": $env:CBSSUBSCRIPTION_NAME, - "SecurityLAWResourceId": "/subscriptions/" + $env:TESTSUBSCRIPTION_ID + "/resourceGroups/rg-core/providers/Microsoft.OperationalInsights/workspaces/mtb-law01", - "HealthLAWResourceId": "/subscriptions/" + $env:TESTSUBSCRIPTION_ID + "/resourceGroups/rg-core/providers/Microsoft.OperationalInsights/workspaces/mtb-law01", + "CBSSubscriptionName": "$CBSSUBSCRIPTION_NAME", + "SecurityLAWResourceId": "/subscriptions/$TESTSUBSCRIPTION_ID/resourceGroups/rg-core/providers/Microsoft.OperationalInsights/workspaces/mtb-law01", + "HealthLAWResourceId": "/subscriptions/$TESTSUBSCRIPTION_ID/resourceGroups/rg-core/providers/Microsoft.OperationalInsights/workspaces/mtb-law01", "Locale": "en-CA", - "lighthouseServiceProviderTenantID": $env:LIGHTHOUSEPROVIDER_TENANTID, + "lighthouseServiceProviderTenantID": "$LIGHTHOUSEPROVIDER_TENANTID", "lighthousePrincipalDisplayName": "SSC CSPM TEAM", - "lighthousePrincipalId": $env:LIGHTHOUSEPROVIDER_PRINCIPALID, - "lighthouseTargetManagementGroupID": $env:LIGHTHOUSEPROVIDER_MGMTGRPID, - "subscriptionId": $env:TESTSUBSCRIPTION_ID, + "lighthousePrincipalId": "$LIGHTHOUSEPROVIDER_PRINCIPALID", + "lighthouseTargetManagementGroupID": "$LIGHTHOUSEPROVIDER_MGMTGRPID", + "subscriptionId": $TESTSUBSCRIPTION_ID, "SSCReadOnlyServicePrincipalNameAPPID": "00000000-0000-0000-0000-000000000000", - "uniqueNameSuffix": $env:UNIQUENAME_SUFFIX, + "uniqueNameSuffix": $UNIQUENAME_SUFFIX, "securityRetentionDays": "730", "cloudUsageProfiles": "1,2" }