Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ def _handle_auth_types(**kwargs):
raise CLIError('SSH parameters cannot be used with password authentication type')
elif not args.admin_password:
raise CLIError('Admin password is required with password authentication type')
elif args.authentication_type == 'sshkey':
elif args.authentication_type == 'ssh':
if args.admin_password:
raise CLIError('Admin password cannot be used with SSH authentication type')

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
type: string
short-summary: OS image (Common, URN or URI).
long-summary: |
Common OS types: Win2012R2Datacenter, Win2012Datacenter, Win2008SP1. For other values please run 'az vm image list'
Common OS types: CentOS, CoreOS, Debian, openSUSE, RHEL, SLES, UbuntuLTS, Win2008SP1, Win2012Datacenter, Win2012R2Datacenter.
Example URN: MicrosoftWindowsServer:WindowsServer:2012-R2-Datacenter:latest
Example URI: http://<storageAccount>.blob.core.windows.net/vhds/osdiskimage.vhd
populator-commands:
Expand All @@ -29,7 +29,7 @@
- name: Create a Linux VM with SSH key authentication, add a public DNS entry and add to an existing Virtual Network and Availability Set.
text: >
az vm create --image <linux image from 'az vm image list'>
--admin-username myadmin --admin-password Admin_001 --authentication-type sshkey
--authentication-type ssh
--virtual-network-type existing --virtual-network-name myvnet --subnet-name default
--availability-set-type existing --availability-set-id myavailset
--public-ip-address-type new --dns-name-for-public-ip myGloballyUniqueVmDnsName
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,16 +76,7 @@
'name': '--admin-username',
'default': getpass.getuser(),
'help': 'Admin login. Defaults to current username.'
}
}

# EXTRA PARAMETER SETS

VM_CREATE_EXTRA_PARAMETERS = {
'image': {
'name': '--image',
'action': VMImageFieldAction
},
},
'ssh_key_value': {
'name': '--ssh-key-value',
'action': VMSSHFieldAction
Expand All @@ -100,6 +91,15 @@
}
}

# EXTRA PARAMETER SETS

VM_CREATE_EXTRA_PARAMETERS = {
'image': {
'name': '--image',
'action': VMImageFieldAction
},
}

VM_PATCH_EXTRA_PARAMETERS = {
'resource_group_name':
extend_parameter(PARAMETER_ALIASES['resource_group_name'], required=True),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
},
"adminUsername": {
"type": "string",
"default": "",
"metadata": {
"description": "Username for the Virtual Machine."
}
Expand All @@ -28,7 +27,7 @@
"defaultValue": "password",
"allowedValues": [
"password",
"sshkey"
"ssh"
],
"metadata": {
"description": "Password or SSH Public Key authentication."
Expand Down Expand Up @@ -170,7 +169,7 @@
},
"publicIpAddressType": {
"type": "string",
"defaultValue": "none",
"defaultValue": "new",
"allowedValues": [
"none",
"new",
Expand Down Expand Up @@ -298,6 +297,10 @@
"Win2008R2SP1": "latest",
"Custom": "[parameters('osVersion')]"
},
"authTypePath": {
"ssh": "sshkey",
"password": "password"
},
"vnetDeploymentName": "[concat('VNet', variables('vmName'))]",
"nicName": "[concat('VMNic', parameters('name'))]",
"vnetAddressPrefix": "[parameters('virtualNetworkIpAddressPrefix')]",
Expand Down Expand Up @@ -406,7 +409,7 @@
"properties": {
"mode": "Incremental",
"templateLink": {
"uri": "[concat(parameters('_artifactsLocation'), '/nested_templates/vm_', parameters('availabilitySetType'), '_', parameters('authenticationType'), '.json')]",
"uri": "[concat(parameters('_artifactsLocation'), '/nested_templates/vm_', parameters('availabilitySetType'), '_', variables('authTypePath')[parameters('authenticationType')], '.json')]",
"contentVersion": "1.0.0.0"
},
"parameters": {
Expand All @@ -433,5 +436,13 @@
}
],
"outputs": {
"vm": {
"value": "[reference(variables('vmDeploymentName')).outputs.vm.value]",
"type": "object"
},
"vmNic": {
"value": "[reference(variables('nicDeploymentName')).outputs.vmNic.value]",
"type": "object"
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,7 @@ class DeploymentVM(Model):
:param admin_username: Username for the Virtual Machine.
:type admin_username: str
:param authentication_type: Password or SSH Public Key authentication.
Possible values include: 'password', 'sshkey'. Default value: "password"
.
Possible values include: 'password', 'ssh'. Default value: "password" .
:type authentication_type: str
:param availability_set_id: Existing availability set for the VM.
:type availability_set_id: str
Expand Down Expand Up @@ -82,8 +81,8 @@ class DeploymentVM(Model):
:param public_ip_address_name: Name of public IP address to use.
:type public_ip_address_name: str
:param public_ip_address_type: Use a public IP Address for the VM Nic.
Possible values include: 'none', 'new', 'existing'. Default value:
"none" .
Possible values include: 'none', 'new', 'existing'. Default value: "new"
.
:type public_ip_address_type: str
:param size: The VM Size that should be created. See
https://azure.microsoft.com/en-us/pricing/details/virtual-machines/ for
Expand Down Expand Up @@ -127,7 +126,6 @@ class DeploymentVM(Model):
_validation = {
'uri': {'required': True, 'constant': True},
'_artifacts_location': {'required': True, 'constant': True},
'admin_username': {'required': True},
'name': {'required': True},
'mode': {'required': True, 'constant': True},
}
Expand Down Expand Up @@ -177,7 +175,7 @@ class DeploymentVM(Model):

mode = "Incremental"

def __init__(self, name, content_version=None, storage_container_name="vhds", virtual_network_name=None, subnet_ip_address_prefix="10.0.0.0/24", private_ip_address_allocation="Dynamic", dns_name_for_public_ip=None, storage_account_type="new", os_disk_uri=None, virtual_network_type="new", admin_password=None, os_sku="2012-R2-Datacenter", subnet_name=None, os_type="Win2012R2Datacenter", admin_username=None, os_version="latest", os_disk_name="osdiskimage", ssh_dest_key_path=None, os_offer="WindowsServer", public_ip_address_allocation="Dynamic", authentication_type="password", storage_account_name=None, storage_redundancy_type="Standard_LRS", size="Standard_A2", public_ip_address_type="none", virtual_network_ip_address_prefix="10.0.0.0/16", availability_set_id=None, ssh_key_value=None, location=None, os_publisher="MicrosoftWindowsServer", availability_set_type="none", public_ip_address_name=None, dns_name_type="none"):
def __init__(self, name, content_version=None, admin_password=None, admin_username=None, authentication_type="password", availability_set_id=None, availability_set_type="none", dns_name_for_public_ip=None, dns_name_type="none", location=None, os_disk_name="osdiskimage", os_disk_uri=None, os_offer="WindowsServer", os_publisher="MicrosoftWindowsServer", os_sku="2012-R2-Datacenter", os_type="Win2012R2Datacenter", os_version="latest", private_ip_address_allocation="Dynamic", public_ip_address_allocation="Dynamic", public_ip_address_name=None, public_ip_address_type="new", size="Standard_A2", ssh_dest_key_path=None, ssh_key_value=None, storage_account_name=None, storage_account_type="new", storage_container_name="vhds", storage_redundancy_type="Standard_LRS", subnet_ip_address_prefix="10.0.0.0/24", subnet_name=None, virtual_network_ip_address_prefix="10.0.0.0/16", virtual_network_name=None, virtual_network_type="new"):
self.content_version = content_version
self.admin_password = admin_password
self.admin_username = admin_username
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@

from .. import models


class VMOperations(object):
"""VMOperations operations.

Expand All @@ -31,7 +32,7 @@ def __init__(self, client, config, serializer, deserializer):
self.config = config

def create_or_update(
self, resource_group_name, deployment_name, name, content_version=None, storage_container_name="vhds", virtual_network_name=None, subnet_ip_address_prefix="10.0.0.0/24", private_ip_address_allocation="Dynamic", dns_name_for_public_ip=None, storage_account_type="new", os_disk_uri=None, virtual_network_type="new", admin_password=None, os_sku="2012-R2-Datacenter", subnet_name=None, os_type="Win2012R2Datacenter", admin_username=None, os_version="latest", os_disk_name="osdiskimage", ssh_dest_key_path=None, os_offer="WindowsServer", public_ip_address_allocation="Dynamic", authentication_type="password", storage_account_name=None, storage_redundancy_type="Standard_LRS", size="Standard_A2", public_ip_address_type="none", virtual_network_ip_address_prefix="10.0.0.0/16", availability_set_id=None, ssh_key_value=None, location=None, os_publisher="MicrosoftWindowsServer", availability_set_type="none", public_ip_address_name=None, dns_name_type="none", custom_headers={}, raw=False, **operation_config):
self, resource_group_name, deployment_name, name, content_version=None, admin_password=None, admin_username=None, authentication_type="password", availability_set_id=None, availability_set_type="none", dns_name_for_public_ip=None, dns_name_type="none", location=None, os_disk_name="osdiskimage", os_disk_uri=None, os_offer="WindowsServer", os_publisher="MicrosoftWindowsServer", os_sku="2012-R2-Datacenter", os_type="Win2012R2Datacenter", os_version="latest", private_ip_address_allocation="Dynamic", public_ip_address_allocation="Dynamic", public_ip_address_name=None, public_ip_address_type="new", size="Standard_A2", ssh_dest_key_path=None, ssh_key_value=None, storage_account_name=None, storage_account_type="new", storage_container_name="vhds", storage_redundancy_type="Standard_LRS", subnet_ip_address_prefix="10.0.0.0/24", subnet_name=None, virtual_network_ip_address_prefix="10.0.0.0/16", virtual_network_name=None, virtual_network_type="new", custom_headers={}, raw=False, **operation_config):
"""
Create or update a virtual machine.

Expand All @@ -40,16 +41,18 @@ def create_or_update(
:type resource_group_name: str
:param deployment_name: The name of the deployment.
:type deployment_name: str
:param name: The VM resource name.
:param name: The VM name.
:type name: str
:param content_version: If included it must match the ContentVersion
in the template.
:type content_version: str
:param admin_password: Password for the Virtual Machine. Required if
SSH (Linux only) is not specified.
:type admin_password: str
:param admin_username: Username for the Virtual Machine.
:type admin_username: str
:param authentication_type: Password or SSH Public Key
authentication. Possible values include: 'password', 'sshkey'
authentication. Possible values include: 'password', 'ssh'
:type authentication_type: str
:param availability_set_id: Existing availability set for the VM.
:type availability_set_id: str
Expand Down Expand Up @@ -80,8 +83,6 @@ def create_or_update(
parameters. Possible values include: 'Win2012R2Datacenter',
'Win2012Datacenter', 'Win2008R2SP1', 'Custom'
:type os_type: str
:param admin_username: Username for the Virtual Machine.
:type admin_username: str
:param os_version: The OS version to install.
:type os_version: str
:param private_ip_address_allocation: Private IP address allocation
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,5 +58,9 @@
}
],
"outputs": {
"VMNic": {
"type": "object",
"value": "[reference(parameters('nicName'))]"
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -73,5 +73,9 @@
}
],
"outputs": {
"VMNic": {
"type": "object",
"value": "[reference(parameters('nicName'))]"
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -55,5 +55,9 @@
}
],
"outputs": {
"VMNic": {
"type": "object",
"value": "[reference(parameters('nicName'))]"
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,10 @@
}
],
"outputs": {
"vm": {
"value": "[reference(variables('vmName'))]",
"type": "object"
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -132,5 +132,9 @@
}
],
"outputs": {
"vm": {
"value": "[reference(variables('vmName'))]",
"type": "object"
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -122,5 +122,9 @@
}
],
"outputs": {
"vm": {
"value": "[reference(variables('vmName'))]",
"type": "object"
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -130,5 +130,9 @@
}
],
"outputs": {
"vm": {
"value": "[reference(variables('vmName'))]",
"type": "object"
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -342,7 +342,7 @@
"https://azuresdkci.blob.core.windows.net/templatehost/CreateVM"
]
}
},
},
"required": [
"value"
]
Expand All @@ -363,11 +363,7 @@
"description": "Username for the Virtual Machine.",
"x-ms-client-name": "adminUsername"
}
},
"required": [
"value"
]

}
},
"DeploymentParameter_authenticationType": {
"properties": {
Expand All @@ -377,7 +373,7 @@
"x-ms-client-name": "authenticationType",
"enum": [
"password",
"sshkey"
"ssh"
],
"default": "password"
}
Expand Down Expand Up @@ -428,7 +424,7 @@
"default": "none"
}
}
},
},
"DeploymentParameter_location": {
"properties": {
"value": {
Expand Down Expand Up @@ -513,7 +509,6 @@
"Custom"
],
"default": "Win2012R2Datacenter"
}
}
}

Expand Down Expand Up @@ -576,7 +571,7 @@
"new",
"existing"
],
"default": "none"
"default": "new"
}
}
},
Expand Down