You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Finally, run the `GenerateResourcesAndImage` function, setting the mandatory arguments: image type and where to build and store the resulting managed image:
97
97
98
98
-`SubscriptionId` - your Azure Subscription ID;
99
-
-`ResourceGroupName` - the name of the resource group that will be created within your subscription (e.g., "imagegen-test");
99
+
-`ResourceGroupName` - the name of the resource group that will store the resulting artifact (e.g., "imagegen-test").
100
+
The resource group must already exist in your Azure subscription;
100
101
-`AzureLocation` - the location where resources will be created (e.g., "East US");
101
102
-`ImageType` - the type of image to build (we suggest choosing "UbuntuMinimal" here; other valid options are "Windows2019", "Windows2022", "Windows2025", "Ubuntu2004", "Ubuntu2204", "Ubuntu2404").
102
103
@@ -195,9 +196,10 @@ you can use Packer directly. To do this, you will need:
195
196
- a resource group created in your Azure subscription where the managed image will be stored;
196
197
- a string to be used as a password for the user used to install software (Windows only).
197
198
198
-
Then, you can invoke Packer in your CI/CD pipeline using the following command:
199
+
Then, you can invoke Packer in your CI/CD pipeline using the following commands:
Write-Warning"The `ReuseResourceGroup` and `Force` parameters are deprecated and will be removed in a future release. The resource group will be reused when it already exists and an error will be thrown when it doesn't. If you want to delete the resource group, please delete it manually."
165
-
}
166
-
167
-
if ($Force-and$ReuseResourceGroup) {
168
-
throw"Force and ReuseResourceGroup cannot be used together."
169
-
}
170
-
171
153
Show-LatestCommit-ErrorAction SilentlyContinue
172
154
173
155
# Validate packer is installed
@@ -266,73 +248,8 @@ Function GenerateResourcesAndImage {
266
248
if ($ResourceGroupExists) {
267
249
Write-Verbose"Resource group '$ResourceGroupName' already exists."
268
250
}
269
-
270
-
# Remove resource group if it exists and we are not reusing it
271
-
if ($ResourceGroupExists-and-not$ReuseResourceGroup) {
272
-
if ($Force) {
273
-
# Delete and recreate the resource group
274
-
Write-Host"Deleting resource group '$ResourceGroupName'..."
275
-
az group delete --name $ResourceGroupName--yes --output none
276
-
if ($LastExitCode-ne0) {
277
-
throw"Failed to delete resource group '$ResourceGroupName'."
278
-
}
279
-
Write-Host"Resource group '$ResourceGroupName' was deleted."
0 commit comments