-
Notifications
You must be signed in to change notification settings - Fork 0
71 lines (59 loc) · 2.47 KB
/
nsg-dmz-in-vnet.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
name: CI nsg-dmz-in-vnet
on:
push:
branches: [ main ]
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
jobs:
build:
# The type of runner that the job will run on
runs-on: ubuntu-latest
env:
RESOURCE_GROUP_NAME: "rg-nsg-dmz-in-vnet"
LOCATION: "westeurope"
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
- name: Checkout the repo
uses: actions/checkout@v2
- name: Install dependencies
uses: azure/powershell@v1
with:
azPSVersion: '5.8.0'
inlineScript: |
Set-PSRepository -Name "PSGallery" -InstallationPolicy Trusted
Find-Module -Name Az | Install-Module -Scope CurrentUser
Find-Module -Name Pester | Install-Module -Scope CurrentUser
- name: Substitute default parameters
uses: microsoft/variable-substitution@v1
with:
files: '${{github.workspace}}/Samples/microsoft.network/nsg-dmz-in-vnet/azpester/definition.parameters.json'
env:
parameters.subscriptionId.value: ${{secrets.SUBSCRIPTION_ID}}
parameters.resourceGroupName.value: ${{env.RESOURCE_GROUP_NAME}}
parameters.location.value: ${{env.LOCATION}}
- name: Login
uses: azure/login@v1
with:
creds: ${{secrets.AZURE_CREDENTIALS}}
enable-AzPSSession: true
- name: Deploy template
uses: azure/powershell@v1
with:
azPSVersion: '5.8.0'
inlineScript: |
New-AzResourceGroup -Name ${{env.RESOURCE_GROUP_NAME}} -Location ${{env.LOCATION}}
New-AzResourceGroupDeployment -ResourceGroupName ${{env.RESOURCE_GROUP_NAME}} -TemplateFile "${{github.workspace}}\Samples\microsoft.network\nsg-dmz-in-vnet\arm\azuredeploy.json"
- name: Test
uses: azure/powershell@v1
with:
azPSVersion: '5.8.0'
inlineScript: |
Import-Module "${{github.workspace}}\Source\AzPester.psm1"
cd "${{github.workspace}}\Samples\microsoft.network\nsg-dmz-in-vnet\azpester"
Invoke-AzPester -Definition definition.json -Parameters definition.parameters.json
- name: Clean
uses: azure/powershell@v1
with:
azPSVersion: '5.8.0'
inlineScript: |
Remove-AzResourceGroup -Name ${{env.RESOURCE_GROUP_NAME}} -Force