|
125 | 125 | "vnetName": "[concat(parameters('virtualMachineName'), '-vnet')]", |
126 | 126 | "vnetId": "[resourceId(resourceGroup().name,'Microsoft.Network/virtualNetworks', concat(parameters('virtualMachineName'), '-vnet'))]", |
127 | 127 | "subnetRef": "[concat(variables('vnetId'), '/subnets/', parameters('subnetName'))]", |
128 | | - "postDeploymentScriptArguments": "[concat('-GitHubActionsRunnerToken ', parameters('githubActionsRunnerToken'), ' -GithubActionsRunnerRegistrationUrl ', parameters('githubActionsRunnerRegistrationUrl'), ' -GithubActionsRunnerName ', parameters('virtualMachineName'), ' -Ephemeral ', parameters('ephemeral'), ' -StopService ', parameters('stopService'), ' -GitHubActionsRunnerPath ', parameters('githubActionsRunnerPath'))]" |
| 128 | + "postDeploymentScriptArguments": "[concat('-GitHubActionsRunnerToken ', parameters('githubActionsRunnerToken'), ' -GithubActionsRunnerRegistrationUrl ', parameters('githubActionsRunnerRegistrationUrl'), ' -GithubActionsRunnerName ', parameters('virtualMachineName'), ' -Ephemeral ', parameters('ephemeral'), ' -StopService ', parameters('stopService'), ' -GitHubActionsRunnerPath ', parameters('githubActionsRunnerPath'))]", |
| 129 | + "publicIpAddressName1": "[if(equals(parameters('publicIpAddressName1'), ''), 'dummy', parameters('publicIpAddressName1'))]", |
| 130 | + "publicIpAddressId": { |
| 131 | + "id": "[resourceId(resourceGroup().name, 'Microsoft.Network/publicIpAddresses', parameters('publicIpAddressName1'))]", |
| 132 | + "properties": { |
| 133 | + "deleteOption": "[parameters('pipDeleteOption')]" |
| 134 | + } |
| 135 | + } |
129 | 136 | }, |
130 | 137 | "resources": [ |
131 | 138 | { |
|
136 | 143 | "dependsOn": [ |
137 | 144 | "[concat('Microsoft.Network/networkSecurityGroups/', variables('nsgName'))]", |
138 | 145 | "[concat('Microsoft.Network/virtualNetworks/', variables('vnetName'))]", |
139 | | - "[concat('Microsoft.Network/publicIpAddresses/', parameters('publicIpAddressName1'))]" |
| 146 | + "[concat('Microsoft.Network/publicIpAddresses/', variables('publicIpAddressName1'))]" |
140 | 147 | ], |
141 | 148 | "properties": { |
142 | 149 | "ipConfigurations": [ |
|
147 | 154 | "id": "[variables('subnetRef')]" |
148 | 155 | }, |
149 | 156 | "privateIPAllocationMethod": "Dynamic", |
150 | | - "publicIpAddress": { |
151 | | - "id": "[resourceId(resourceGroup().name, 'Microsoft.Network/publicIpAddresses', parameters('publicIpAddressName1'))]", |
152 | | - "properties": { |
153 | | - "deleteOption": "[parameters('pipDeleteOption')]" |
154 | | - } |
155 | | - } |
| 157 | + "publicIpAddress": "[if(not(equals(parameters('publicIpAddressName1'), '')), variables('publicIpAddressId'), null())]" |
156 | 158 | } |
157 | 159 | } |
158 | 160 | ], |
|
184 | 186 | } |
185 | 187 | }, |
186 | 188 | { |
187 | | - "name": "[parameters('publicIpAddressName1')]", |
| 189 | + "condition": "[not(equals(parameters('publicIpAddressName1'), ''))]", |
| 190 | + "name": "[variables('publicIpAddressName1')]", |
188 | 191 | "type": "Microsoft.Network/publicIpAddresses", |
189 | 192 | "apiVersion": "2020-08-01", |
190 | 193 | "location": "[parameters('location')]", |
|
0 commit comments