< Back

Connect-AppVeyorToHyperV

Fri Jan 10, 2020 8:32 pm

NAME Connect-AppVeyorToHyperV



SYNOPSIS

Command to enable Hyper-V builds. Works with both hosted AppVeyor and AppVeyor Server.





SYNTAX

Connect-AppVeyorToHyperV [-AppVeyorUrl] <String> [-ApiToken] <String> [-SkipDisclaimer] [[-CpuCores] <Int32>]

[[-RamMb] <Int32>] [[-DiskSize] <Int32>] [[-ImagesDirectory] <String>] [[-VmsDirectory] <String>]

[[-PackerTempDirectory] <String>] [[-SubnetId] <String>] [[-SubnetMask] <String>] [[-MasterIPAddress] <String>]

[[-DefaultGateway] <String>] [[-StartIPAddress] <String>] [[-DnsServers] <String>] [[-PreheatedVMs] <String>]

[[-VhdPath] <String>] [[-CommonPrefix] <String>] [[-ImageOs] <String>] [-UpdateWindows] [[-IsoUrl] <String>]

[[-IsoChecksum] <String>] [[-ProductKey] <String>] [[-AVMAKey] <String>] [[-ImageName] <String>] [[-ImageTemplate]

<String>] [[-ImageFeatures] <String>] [[-ImageCustomScript] <String>] [[-ImageCustomScriptAfterReboot] <String>]

[[-CloneVM] <String>] [[-ImageUser] <String>] [[-ImagePassword] <String>] [[-PackerCustomArgs] <String>]

[<CommonParameters>]





DESCRIPTION

You can connect your AppVeyor account (on both hosted AppVeyor and on-premise AppVeyor Server) to Hyper-V host for

AppVeyor to instantiate build VMs on it.





PARAMETERS

-AppVeyorUrl <String>

AppVeyor URL. For hosted AppVeyor it is https://ci.appveyor.com. For Appveyor Server users it is URL of

on-premise AppVeyor Server installation



Required? true

Position? 1

Default value

Accept pipeline input? false

Accept wildcard characters? false



-ApiToken <String>

API key for specific account (not 'All accounts'). Hosted AppVeyor users can find it at

https://ci.appveyor.com/api-keys. Appveyor Server users can find it at <appveyor_server_url>/api-keys.



Required? true

Position? 2

Default value

Accept pipeline input? false

Accept wildcard characters? false



-SkipDisclaimer [<SwitchParameter>]

Skip warning related to computer configration changes. It is recommended to read the warning at least once,

but it can come handy if you need to re-run the command.



Required? false

Position? named

Default value False

Accept pipeline input? false

Accept wildcard characters? false



-CpuCores <Int32>

Number of CPU cores for build VMs.



Required? false

Position? 3

Default value 2

Accept pipeline input? false

Accept wildcard characters? false



-RamMb <Int32>

Memory (in megabytes) for build VMs.



Required? false

Position? 4

Default value 4096

Accept pipeline input? false

Accept wildcard characters? false



-DiskSize <Int32>

Disk Size (in gigabytes) for build VMs.



Required? false

Position? 5

Default value 60

Accept pipeline input? false

Accept wildcard characters? false



-ImagesDirectory <String>

Directory to keep build VM images.



Required? false

Position? 6

Default value

Accept pipeline input? false

Accept wildcard characters? false



-VmsDirectory <String>

Directory to create build VMs.



Required? false

Position? 7

Default value

Accept pipeline input? false

Accept wildcard characters? false



-PackerTempDirectory <String>

Temp directory for Packer VMs.



Required? false

Position? 8

Default value

Accept pipeline input? false

Accept wildcard characters? false



-SubnetId <String>

AppVeyor will create Virtual switch and subnet to use with build VMs and manage build VMs IP configuration in

that subnet. Default value is 10.118.232.0.



Required? false

Position? 9

Default value 10.118.232.0

Accept pipeline input? false

Accept wildcard characters? false



-SubnetMask <String>

Subnet mask to be used with build VMs. Default value is 255.255.255.0.



Required? false

Position? 10

Default value 255.255.255.0

Accept pipeline input? false

Accept wildcard characters? false



-MasterIPAddress <String>

IP address to be assigned to master VM created by Packer. Default value is 10.118.232.2.



Required? false

Position? 11

Default value 10.118.232.2

Accept pipeline input? false

Accept wildcard characters? false



-DefaultGateway <String>

IP address to assign to Virtual Switch NIC, which will be default gateway for VMs. Default value is

10.118.232.1.



Required? false

Position? 12

Default value 10.118.232.1

Accept pipeline input? false

Accept wildcard characters? false



-StartIPAddress <String>

Address from which AppVeyor will start assigning IPs to VMs. It is importand to ensure it is not conflicting

with MasterIPAddress and DefaultGateway, but still in the same subnet (check SubnetMask parameter) and them.



Required? false

Position? 13

Default value 10.118.232.100

Accept pipeline input? false

Accept wildcard characters? false



-DnsServers <String>

DNS server to assign to build VMs NIC.



Required? false

Position? 14

Default value 8.8.8.8; 8.8.4.4

Accept pipeline input? false

Accept wildcard characters? false



-PreheatedVMs <String>



Required? false

Position? 15

Default value 2

Accept pipeline input? false

Accept wildcard characters? false



-VhdPath <String>

Path existing build VM VHD (in case you prefer to skip Packer build and use existing VHD).



Required? false

Position? 16

Default value

Accept pipeline input? false

Accept wildcard characters? false



-CommonPrefix <String>

Command will prepend all created resources (like Hyper-V virtual swith or firewall rule) it creates and with

it.



Required? false

Position? 17

Default value appveyor

Accept pipeline input? false

Accept wildcard characters? false



-ImageOs <String>

Operating system of build VM image. Valid values: 'Windows', 'Linux'. Default value is 'Windows'.



Required? false

Position? 18

Default value Windows

Accept pipeline input? false

Accept wildcard characters? false



-UpdateWindows [<SwitchParameter>]

Update Windows before creating a master VHD.



Required? false

Position? named

Default value False

Accept pipeline input? false

Accept wildcard characters? false



-IsoUrl <String>

ISO from which to install master VM. Can be URK, local and UNC path. Default it Windows Server 2019 Evaluation.



Required? false

Position? 19

Default value

Accept pipeline input? false

Accept wildcard characters? false



-IsoChecksum <String>

SHA256 checksum of installation ISO file. Needed only if IsoUrl parameter specified.



Required? false

Position? 20

Default value

Accept pipeline input? false

Accept wildcard characters? false



-ProductKey <String>

Enter your product key if you are using retail or volume license ISOs.



Required? false

Position? 21

Default value

Accept pipeline input? false

Accept wildcard characters? false



-AVMAKey <String>

To benefit from Automatic virtual machine activation enter respective AVMA Key which can be found at

https://docs.microsoft.com/en-us/window ... #avma-keys. You still need

retail or volume license ISO and ProductKey for initial installation to use AVMA.



Required? false

Position? 22

Default value

Accept pipeline input? false

Accept wildcard characters? false



-ImageName <String>

Description to be passed to Packer and name to be used for AppVeyor image. Default value generated is based

on the value of 'ImageOs' parameter.



Required? false

Position? 23

Default value

Accept pipeline input? false

Accept wildcard characters? false



-ImageTemplate <String>

If you are familiar with the Hashicorp Packer, you can replace template used by this command with another one.

Default value is '.\\minimal-windows-server.json'.



Required? false

Position? 24

Default value

Accept pipeline input? false

Accept wildcard characters? false



-ImageFeatures <String>

Comma-separated list of feature IDs to be installed on the image. Available IDs can be found at

https://github.com/appveyor/build-image ... adata.json under

'installedFeatures'.



Required? false

Position? 25

Default value

Accept pipeline input? false

Accept wildcard characters? false



-ImageCustomScript <String>

Base-64 encoded text of custom sript to execute during image creation. It should not contain reboot

instructions.



Required? false

Position? 26

Default value

Accept pipeline input? false

Accept wildcard characters? false



-ImageCustomScriptAfterReboot <String>

Base-64 encoded text of custom sript to execute during image creation, after reboot. It is usefull for cases

when custom software being installed with 'ImageCustomScript' required some additional action after computer

restarted.



Required? false

Position? 27

Default value

Accept pipeline input? false

Accept wildcard characters? false



-CloneVM <String>

VM name to use as a base for a new VM from.



Required? false

Position? 28

Default value

Accept pipeline input? false

Accept wildcard characters? false



-ImageUser <String>

Username inside the image.



Required? false

Position? 29

Default value

Accept pipeline input? false

Accept wildcard characters? false



-ImagePassword <String>

User password inside the image.



Required? false

Position? 30

Default value

Accept pipeline input? false

Accept wildcard characters? false



-PackerCustomArgs <String>

Extra args for Packer.



Required? false

Position? 31

Default value

Accept pipeline input? false

Accept wildcard characters? false



<CommonParameters>

This cmdlet supports the common parameters: Verbose, Debug,

ErrorAction, ErrorVariable, WarningAction, WarningVariable,

OutBuffer, PipelineVariable, and OutVariable. For more information, see

about_CommonParameters (https:/go.microsoft.com/fwlink/?LinkID=113216).



INPUTS



OUTPUTS



-------------------------- EXAMPLE 1 --------------------------



PS C:\\>Connect-AppVeyorToHyperV



Let command collect all required information









-------------------------- EXAMPLE 2 --------------------------



PS C:\\>Connect-AppVeyorToHyperV -ApiToken XXXXXXXXXXXXXXXXXXXXX -AppVeyorUrl "https://ci.appveyor.com" -CpuCores 2

-RamMb 2048 -ImageOs "Windows"



Run command with all required parameters so command will ask no questions. It will create build VM image and

configure Hyper-V build cloud in AppVeyor.











RELATED LINKS