< Back

Connect-AppVeyorToAzure

Fri Jan 10, 2020 8:29 pm

NAME Connect-AppVeyorToAzure



SYNOPSIS

Command to enable Azure builds. Works with both hosted AppVeyor and AppVeyor Server.





SYNTAX

Connect-AppVeyorToAzure [-AppVeyorUrl] <String> [-ApiToken] <String> [-UseCurrentAzureLogin] [-SkipDisclaimer]

[[-Location] <String>] [[-VmSize] <String>] [-BehindAzureLB] [[-VhdFullPath] <String>] [[-CommonPrefix] <String>]

[[-ImageOs] <String>] [[-ImageName] <String>] [[-ImageTemplate] <String>] [[-ImageFeatures] <String>]

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





DESCRIPTION

You can connect your AppVeyor account (on both hosted AppVeyor and on-premise AppVeyor Server) to your own Azure

subscription for AppVeyor to instantiate build VMs in it. It has a lot of benefits like having ability to

customize your build image, select desired VM size, set custom build timeout and much more. To simplify setup

process for you, this command provisions necessary Azure resources, runs Hashicorp Packer to create a basic build

image (based on Windows Server 2019), and puts all AppVeyor configuration together. After running this command,

you should be able to start builds on Azure immediately (and optionally customize your Azure build environment

later).





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



-UseCurrentAzureLogin [<SwitchParameter>]

Use Azure user currently logged in PowerShell and its selected subscription. If this parameter is not set or

no Azure user is already logged in PowerShell, command will ask to login to Azure and (if user has multiple

subscriptions) select the subscription. It is not recommended to use this switch parameter for the first

command run, and select Azure user and subscription carefully. 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



-SkipDisclaimer [<SwitchParameter>]

Skip warning related to Azure resources creation and potential Azure charges. 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



-Location <String>

Azure location (or region) where you want command to create build worker image and all additional required

resources. Also AppVeyor will create build VMs in this location. Use short notation (not display name) e.g.

'westus', not 'West US'.



Required? false

Position? 3

Default value

Accept pipeline input? false

Accept wildcard characters? false



-VmSize <String>

Size of Azure build VM. Use short notation (not display name) e.g. 'Standard_D2s_v3', not 'Standard D2s v3'.



Required? false

Position? 4

Default value

Accept pipeline input? false

Accept wildcard characters? false



-BehindAzureLB [<SwitchParameter>]

Create public static IP, Azure Load balancer and nessesary inbound/outbound NAT rules. Place build VMs behind

it. Useful if you need to limit access from build VMs to private resources by specific static (fixed) IP

address.



Required? false

Position? named

Default value False

Accept pipeline input? false

Accept wildcard characters? false



-VhdFullPath <String>

It can happen that you run the command, and it created a valid VHD, but some AppVeyor settings were not set

correctly (or just you want to change them without doing it in the AppVeyor build environments UI). In this

case you want to skip the most time consuming step (creating a VHD) and pass already created VHD path to this

parameter.



Required? false

Position? 5

Default value

Accept pipeline input? false

Accept wildcard characters? false



-CommonPrefix <String>

Command will prepend all created Azure resources names with it. Because of storage account names restrictions,

is must contain only letters and numbers and be shorter than 16 symbols. Default value is 'appveyor'.



Required? false

Position? 6

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? 7

Default value Windows

Accept pipeline input? false

Accept wildcard characters? false



-ImageName <String>

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

based on the value of 'ImageOs' parameter.



Required? false

Position? 8

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 generated is based on the value of 'ImageOs' parameter.



Required? false

Position? 9

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? 10

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? 11

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? 12

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-AppVeyorToAzure



Let command collect all required information.









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



PS C:\\>Connect-AppVeyorToAzure -AppVeyorUrl "https://ci.appveyor.com" -ApiToken XXXXXXXXXXXXXXXXXXXXX -Location

westus -VmSize Standard_D2s_v3 -SkipDisclaimer -UseCurrentAzureLogin



Run command with all required parameters, and command will ask no questions. It will create resources in Azure

West US region and connect them to the hosted AppVeyor.











RELATED LINKS