Skip to content

Commit

Permalink
Merge pull request #50 from JFolberth/feature/bicep_deploymentstack
Browse files Browse the repository at this point in the history
Feature/bicep deploymentstack
  • Loading branch information
JFolberth authored Jun 7, 2024
2 parents fd0b7bf + 8e10b2c commit 9ec79fa
Show file tree
Hide file tree
Showing 4 changed files with 163 additions and 6 deletions.
13 changes: 7 additions & 6 deletions jobs/adf_deploy_env_job.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,14 +53,15 @@ jobs:
ScriptArguments: '-armTemplate "${{ variables.ARMTemplatePath }}" -ResourceGroupName ${{ variables.resourceGroupName }} -DataFactoryName ${{ variables.dataFactoryName }} -predeployment $true -deleteDeployment $false'
displayName: 'Stop ADF Triggers'
workingDirectory: ${{ parameters.workingDirectory }}
- template: ../tasks/ado_ARM_deployment_task.yml
- template: ../tasks/azcli_stack_deployment_rg_create.yml.yml
parameters:
azureResourceManagerConnection: ${{ variables.azureServiceConnectionName }}
azureSubscriptionName: ${{ variables.azureServiceConnectionName }}
resourceGroupName: ${{ variables.resourceGroupName }}
location: ${{ parameters.location }}
csmFile: ${{ variables.ARMTemplatePath }}
csmParametersFile: '${{ parameters.artifactName }}/parameters/${{ parameters.environmentName }}.${{ parameters.regionAbrv }}.${{ parameters.templateParametersFile }}.json'
overrideParameters: ${{ parameters.overrideParameters }}
deploymentStackName: ${{ parameters.serviceName }}_deploymentStack_${{ parameters.environmentName }}_${{ parameters.regionAbrv }}
templateFileName: '$(Agent.BuildDirectory)/${{ variables.ARMTemplatePath }}'
parametersFileName: '$(Agent.BuildDirectory)/${{ parameters.artifactName }}/parameters/${{ parameters.environmentName }}.${{ parameters.regionAbrv }}.${{ parameters.templateParametersFile }}.json'
additionalArguments: ${{ parameters.overrideParameters }}
command: 'create'
- template: ../tasks/azpwsh_file_execute_task.yml
parameters:
azureSubscriptionName: ${{ variables.azureServiceConnectionName }}
Expand Down
54 changes: 54 additions & 0 deletions tasks/azcli_stack_deployment_mg_create.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
parameters:
- name: azureSubscriptionName
type: string
default: ''
- name: actionOnUnmanage
type: string
default: 'deleteAll'
- name: denySettingsMode
type: string
default: 'denyDelete'
- name: deploymentStackName
type: string
default: ''
- name: managementGroupID
type: string
default: ''
- name: resourceGroupName
type: string
default: ''
- name: deploymentStackDescription
type: string
default: 'Resource Group Deployment Stack'
- name: parametersFileName
type: string
default: 'parameters.json'
- name: inlineParameters
type: string
default: ''
- name: deploymentStackTags
type: string
default: ''
- name: templateFileName
type: string
default: 'main.bicep'
- name: command
type: string
default: 'validate'
- name: additionalArguments
type: string
default: ''

steps:
- task: AzureCLI@2
displayName: '${{ parameters.command }} deployment stack'
inputs:
azureSubscription: ${{ parameters.azureSubscriptionName }}
scriptType: 'pscore'
scriptLocation: 'inlineScript'
inlineScript: |
az stack group ${{ parameters.command }} --name ${{ parameters.deploymentStackName }} --action-on-unmanage ${{ parameters.actionOnUnmanage }} `
--deny-settings-mode ${{ parameters.denySettingsMode }} --management-group-id ${{ parameters.managementGroupID }} `
--template-file '$(Agent.BuildDirectory)/${{parameters.templateFileName}}' --parameters '$(Agent.BuildDirectory)/${{parameters.parametersFileName}}' ${{ parameters.inlineParameters }} `
--description "${{ parameters.deploymentStackDescription }}" ${{ parameters.additionalArguments }} `
--tags ${{ parameters.deploymentStackTags }} --yes
51 changes: 51 additions & 0 deletions tasks/azcli_stack_deployment_rg_create.yml.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
parameters:
- name: azureSubscriptionName
type: string
default: ''
- name: actionOnUnmanage
type: string
default: 'deleteAll'
- name: denySettingsMode
type: string
default: 'denyDelete'
- name: deploymentStackName
type: string
default: ''
- name: resourceGroupName
type: string
default: ''
- name: deploymentStackDescription
type: string
default: 'Resource Group Deployment Stack'
- name: parametersFileName
type: string
default: 'parameters.json'
- name: inlineParameters
type: string
default: ''
- name: deploymentStackTags
type: string
default: ''
- name: templateFileName
type: string
default: 'main.bicep'
- name: command
type: string
default: 'validate'
- name: additionalArguments
type: string
default: ''

steps:
- task: AzureCLI@2
displayName: '${{ parameters.command }} deployment stack'
inputs:
azureSubscription: ${{ parameters.azureSubscriptionName }}
scriptType: 'pscore'
scriptLocation: 'inlineScript'
inlineScript: |
az stack group ${{ parameters.command }} --name ${{ parameters.deploymentStackName }} --action-on-unmanage ${{ parameters.actionOnUnmanage }} `
--deny-settings-mode ${{ parameters.denySettingsMode }} --resource-group ${{ parameters.resourceGroupName }} `
--template-file '${{parameters.templateFileName}}' --parameters '${{parameters.parametersFileName}}' ${{ parameters.inlineParameters }} `
--description "${{ parameters.deploymentStackDescription }}" ${{ parameters.additionalArguments }} `
--tags ${{ parameters.deploymentStackTags }} --yes
51 changes: 51 additions & 0 deletions tasks/azcli_stack_deployment_sub_create.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
parameters:
- name: azureSubscriptionName
type: string
default: ''
- name: actionOnUnmanage
type: string
default: 'deleteAll'
- name: denySettingsMode
type: string
default: 'denyDelete'
- name: deploymentStackName
type: string
default: ''
- name: deploymentStackDescription
type: string
default: 'Resource Group Deployment Stack'
- name: parametersFileName
type: string
default: 'parameters.json'
- name: inlineParameters
type: string
default: ''
- name: deploymentStackTags
type: string
default: ''
- name: templateFileName
type: string
default: 'main.bicep'
- name: command
type: string
default: 'validate'
- name: additionalArguments
type: string
default: ''
- name: deploymentResourceGroup
type: string
default: ''

steps:
- task: AzureCLI@2
displayName: '${{ parameters.command }} deployment stack'
inputs:
azureSubscription: ${{ parameters.azureSubscriptionName }}
scriptType: 'pscore'
scriptLocation: 'inlineScript'
inlineScript: |
az stack group ${{ parameters.command }} --name ${{ parameters.deploymentStackName }} --action-on-unmanage ${{ parameters.actionOnUnmanage }} `
--deny-settings-mode ${{ parameters.denySettingsMode }} --deployment-resoruce-group ${{ parameters.deploymentResourceGroup }}`
--template-file '$(Agent.BuildDirectory)/${{parameters.templateFileName}}' --parameters '$(Agent.BuildDirectory)/${{parameters.parametersFileName}}' ${{ parameters.inlineParameters }} `
--description "${{ parameters.deploymentStackDescription }}" ${{ parameters.additionalArguments }} `
--tags ${{ parameters.deploymentStackTags }} --yes

0 comments on commit 9ec79fa

Please sign in to comment.