Microsoft Azure¶
Default builder type: Microsoft Azure
Require Cloud Account: Yes
The Azure builder provides information for building and publishing the machine image to the Microsoft Azure cloud platform. This builder type is the default name provided by UForge AppCenter.
Note
This builder type name can be changed by your UForge administrator. To get the available builder types, please refer to format
The Azure builder section has the following definition when using YAML:
---
builders:
- type: Microsoft Azure
# the rest of the definition goes here.
If you are using JSON:
{
"builders": [
{
"type": "Microsoft Azure",
...the rest of the definition goes here.
}
]
}
Building a Machine Image¶
For building an image, the valid keys are:
type
(mandatory): a string providing the machine image type to build. Default builder type for Azure:Microsoft Azure
. To get the available builder type, please refer to formatinstallation
(optional): an object providing low-level installation or first boot options. These override any installation options in the stack section. The following valid keys for installation are:diskSize
(mandatory): an integer providing the disk size of the machine image to create. Note, this overrides any disk size information in the Stack. This cannot be used if an advanced partitioning table is defined in the stack.
Note
When building from a scan, your yaml or json file must contain an installation
section in builders
. This is mandatory when you create a new template, but might be missing when you build from a scan. Make sure it is present or your build will fail.
Publishing a Machine Image with Azure Connector¶
To publish an image, the valid keys are:
type
(mandatory): a string providing the machine image type to build. Default builder type for Azure:Microsoft Azure
. To get the available builder type, please refer to formataccount
(mandatory): an object providing all the cloud account information to authenticate and publish a machine image to Azure.storageAccount
(mandatory): a string providing the storage account name to use for uploading and storing the machine image. The storage account is the highest level of the namespace for accessing each of the fundamental services. It must exist in your Microsoft account.container
(mandatory): the container that will contain the blob file in Azure Cloud. If the name provided does not already exist it will be created.blob
(mandatory): the name of the vhd blob that will contain the machine image data. It must end with “.vhd”. If it already exists it will be overwritten with the new blob info.displayName
(mandatory): a string providing the name of the machine image to display in Azure cloud. If an image with this name already exists it will be overwritten.resourceGroup
(optional): an existing resource group available in your clound accound. By default the resource group of your storage account will be used.
Azure Cloud Account¶
Key: account
Used to authenticate the Azure platform. The Azure cloud account has the following valid keys:
type
(mandatory): a string providing the cloud account type. Default platform type for Microsoft Azure:Microsoft Azure
. To get the available platform type, please refer to platformname
(mandatory): a string providing the name of the cloud account. This name can be used in a builder section to reference the rest of the cloud account information.tenantId
(mandatory): The tenant ID also named “Directory ID”. See Microsoft Azure tenant ID documentation to retrieve yours.subscriptionId
(mandatory): The subscription ID that will be used by UForge.applicationId
(mandatory): The application ID that will be used by UForge. See Microsoft Azure application ID documentation to create one application.applicationKey
(mandatory): The application authentication key associated to the application ID.
Note
In the case where name or file is used to reference a cloud account, all the other keys are no longer required in the account definition for the builder.
Example¶
The following example shows an Azure builder with all the information to build and publish a machine image to Azure.
If you are using YAML:
---
builders:
- type: Microsoft Azure
account:
type: Microsoft Azure
name: My Azure account
tenantId: aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeeee
subscriptionId: ffffffff-eeee-dddd-cccc-bbbbbbbbbbbbb
applicationId: 0000000-1111-2222-3333-4444444444444
applicationKey: myApplicationKey
storageAccount: mystorageaccount
container: mycontainer
resourceGroup: myResourceGroup
blob: myBlob.vhd
displayName: myImage
If you are using JSON:
{
"builders": [
{
"type": "Microsoft Azure",
"account": {
"type": "Microsoft Azure",
"name": "My Azure account",
"tenantId": "aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeeee",
"subscriptionId": "ffffffff-eeee-dddd-cccc-bbbbbbbbbbbbb",
"applicationId": "0000000-1111-2222-3333-4444444444444",
"applicationKey": "myApplicationKey"
},
"storageAccount":"mystorageaccount",
"container":"mycontainer",
"resourceGroup":"myResourceGroup",
"blob":"myBlob.vhd",
"displayName":"myImage"
}
]
}
Referencing the Azure Cloud Account¶
To help with security, the cloud account information can be referenced by the builder section. This example is the same as the previous example but with the account information in another file. Create a YAML file azure-app-account.yml
.
---
accounts:
- type: Microsoft Azure
name: My Azure account
tenantId: aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeeee
subscriptionId: ffffffff-eeee-dddd-cccc-bbbbbbbbbbbbb
applicationId: 0000000-1111-2222-3333-4444444444444
applicationKey: myApplicationKey
If you are using JSON, create a JSON file azure-app-account.json
:
{
"accounts": [
{
"type": "Microsoft Azure",
"name": "My Azure account",
"tenantId": "aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeeee",
"subscriptionId": "ffffffff-eeee-dddd-cccc-bbbbbbbbbbbbb",
"applicationId": "0000000-1111-2222-3333-4444444444444",
"applicationKey": "myApplicationKey"
}
]
}
The builder section can either be referenced by using file
or name
.
Reference by file:
If you are using YAML:
---
builders:
- type: Microsoft Azure
account:
file: "/home/user/accounts/azure-app-account.yml"
storageAccount: mystorageaccount
container: mycontainer
resourceGroup: myResourceGroup
blob: myBlob.vhd
displayName: myImage
If you are using JSON:
{
"builders": [
{
"type": "Microsoft Azure",
"account": {
"file": "/home/user/accounts/azure-app-account.json"
},
"storageAccount":"mystorageaccount",
"container":"mycontainer",
"resourceGroup":"myResourceGroup",
"blob":"myBlob.vhd",
"displayName":"myImage"
}
]
}
Reference by name, note the cloud account must already be created by using account create
.
If you are using YAML:
---
builders:
- type: Microsoft Azure
account:
name: My Azure Account
storageAccount: mystorageaccount
container: mycontainer
resourceGroup: myResourceGroup
blob: myBlob.vhd
displayName: myImage
If you are using JSON:
{
"builders": [
{
"type": "Microsoft Azure",
"account": {
"name": "My Azure Account"
},
"storageAccount":"mystorageaccount",
"container":"mycontainer",
"resourceGroup":"myResourceGroup",
"blob":"myBlob.vhd",
"displayName":"myImage"
}
]
}
Deploying a Published Machine Image¶
To deploy a published machine image to Microsoft Azure the Azure builder section must have the following definition when using YAML:
---
provisioner:
type: Azure
name: MyDeploy
userName: MyUserName
userSshKey: MySshKey
If you are using JSON:
{
"provisioner": {
"type": "Azure",
"name": "MyDeploy",
"userName": "MyUserName",
"userSshKey": "MySshKey"
}
}
The valid keys are:
type
(mandatory): a string providing the cloud provider on which the published image should be deployed.name
(mandatory): the name of the published machine image.userName
(mandatory): the name for the user account on the instance.userSshKey
(optional): the public ssh key for the user account.userSshKeyFile
(optional): a file containing the public ssh key for the user account.
If no ssh key is given, you will have to give a password for the user account.