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
45 changes: 45 additions & 0 deletions azure-cli.pyproj
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,28 @@
<Compile Include="command_modules\azure-cli-storage\azure\cli\command_modules\storage\tests\test_storage_validators.py" />
<Compile Include="command_modules\azure-cli-storage\azure\cli\command_modules\storage\_params.py" />
<Compile Include="command_modules\azure-cli-storage\azure\cli\command_modules\storage\_validators.py" />
<Compile Include="command_modules\azure-cli-vm\azure\cli\command_modules\vm\mgmt\lib\credentials.py" />
<Compile Include="command_modules\azure-cli-vm\azure\cli\command_modules\vm\mgmt\lib\exceptions.py" />
<Compile Include="command_modules\azure-cli-vm\azure\cli\command_modules\vm\mgmt\lib\models\basic_dependency.py" />
<Compile Include="command_modules\azure-cli-vm\azure\cli\command_modules\vm\mgmt\lib\models\dependency.py" />
<Compile Include="command_modules\azure-cli-vm\azure\cli\command_modules\vm\mgmt\lib\models\deployment_extended.py" />
<Compile Include="command_modules\azure-cli-vm\azure\cli\command_modules\vm\mgmt\lib\models\deployment_parameter_artifacts_location.py" />
<Compile Include="command_modules\azure-cli-vm\azure\cli\command_modules\vm\mgmt\lib\models\deployment_parameter_virtual_network_ip_address_prefix.py" />
<Compile Include="command_modules\azure-cli-vm\azure\cli\command_modules\vm\mgmt\lib\models\deployment_properties_extended.py" />
<Compile Include="command_modules\azure-cli-vm\azure\cli\command_modules\vm\mgmt\lib\models\deployment_vm.py" />
<Compile Include="command_modules\azure-cli-vm\azure\cli\command_modules\vm\mgmt\lib\models\parameters_link.py" />
<Compile Include="command_modules\azure-cli-vm\azure\cli\command_modules\vm\mgmt\lib\models\provider - Copy.py" />
<Compile Include="command_modules\azure-cli-vm\azure\cli\command_modules\vm\mgmt\lib\models\provider.py" />
<Compile Include="command_modules\azure-cli-vm\azure\cli\command_modules\vm\mgmt\lib\models\provider_resource_type.py" />
<Compile Include="command_modules\azure-cli-vm\azure\cli\command_modules\vm\mgmt\lib\models\template_link.py" />
<Compile Include="command_modules\azure-cli-vm\azure\cli\command_modules\vm\mgmt\lib\models\vm_creation_client_enums.py" />
<Compile Include="command_modules\azure-cli-vm\azure\cli\command_modules\vm\mgmt\lib\models\__init__.py" />
<Compile Include="command_modules\azure-cli-vm\azure\cli\command_modules\vm\mgmt\lib\operations\vm_operations.py" />
<Compile Include="command_modules\azure-cli-vm\azure\cli\command_modules\vm\mgmt\lib\operations\__init__.py" />
<Compile Include="command_modules\azure-cli-vm\azure\cli\command_modules\vm\mgmt\lib\version.py" />
<Compile Include="command_modules\azure-cli-vm\azure\cli\command_modules\vm\mgmt\lib\vm_creation_client.py" />
<Compile Include="command_modules\azure-cli-vm\azure\cli\command_modules\vm\mgmt\lib\__init__.py" />
<Compile Include="command_modules\azure-cli-vm\azure\cli\command_modules\vm\mgmt\__init__.py" />
<Compile Include="command_modules\azure-cli-vm\azure\cli\command_modules\vm\tests\test_custom_vm_commands.py" />
<Compile Include="command_modules\azure-cli-resource\azure\cli\command_modules\resource\tests\test_resource_list_odata_filter.py" />
<Compile Include="command_modules\azure-cli-resource\azure\cli\command_modules\resource\tests\test_api_check.py">
Expand Down Expand Up @@ -197,6 +219,15 @@
<Folder Include="command_modules\azure-cli-vm\azure\cli\" />
<Folder Include="command_modules\azure-cli-vm\azure\cli\command_modules\" />
<Folder Include="command_modules\azure-cli-vm\azure\cli\command_modules\vm\" />
<Folder Include="command_modules\azure-cli-vm\azure\cli\command_modules\vm\mgmt\" />
<Folder Include="command_modules\azure-cli-vm\azure\cli\command_modules\vm\mgmt\lib\" />
<Folder Include="command_modules\azure-cli-vm\azure\cli\command_modules\vm\mgmt\lib\models\" />
<Folder Include="command_modules\azure-cli-vm\azure\cli\command_modules\vm\mgmt\lib\models\__pycache__\" />
<Folder Include="command_modules\azure-cli-vm\azure\cli\command_modules\vm\mgmt\lib\operations\" />
<Folder Include="command_modules\azure-cli-vm\azure\cli\command_modules\vm\mgmt\lib\operations\__pycache__\" />
<Folder Include="command_modules\azure-cli-vm\azure\cli\command_modules\vm\mgmt\lib\__pycache__\" />
<Folder Include="command_modules\azure-cli-vm\azure\cli\command_modules\vm\mgmt\nested_templates\" />
<Folder Include="command_modules\azure-cli-vm\azure\cli\command_modules\vm\mgmt\__pycache__\" />
<Folder Include="command_modules\azure-cli-vm\azure\cli\command_modules\vm\tests\" />
<Folder Include="command_modules\azure-cli-vm\azure\cli\command_modules\vm\tests\recordings\" />
</ItemGroup>
Expand All @@ -222,6 +253,20 @@
<Content Include="command_modules\azure-cli-resource\requirements.txt" />
<Content Include="command_modules\azure-cli-storage\requirements.txt" />
<Content Include="command_modules\azure-cli-taskhelp\requirements.txt" />
<Content Include="command_modules\azure-cli-vm\azure\cli\command_modules\vm\mgmt\azuredeploy.json" />
<Content Include="command_modules\azure-cli-vm\azure\cli\command_modules\vm\mgmt\nested_templates\ExistingStorageAccount.json" />
<Content Include="command_modules\azure-cli-vm\azure\cli\command_modules\vm\mgmt\nested_templates\ExistingVNet.json" />
<Content Include="command_modules\azure-cli-vm\azure\cli\command_modules\vm\mgmt\nested_templates\NewStorageAccount.json" />
<Content Include="command_modules\azure-cli-vm\azure\cli\command_modules\vm\mgmt\nested_templates\NewVNet.json" />
<Content Include="command_modules\azure-cli-vm\azure\cli\command_modules\vm\mgmt\nested_templates\nic_ip_existing_dns_none.json" />
<Content Include="command_modules\azure-cli-vm\azure\cli\command_modules\vm\mgmt\nested_templates\nic_ip_new_dns_new.json" />
<Content Include="command_modules\azure-cli-vm\azure\cli\command_modules\vm\mgmt\nested_templates\nic_ip_new_dns_none.json" />
<Content Include="command_modules\azure-cli-vm\azure\cli\command_modules\vm\mgmt\nested_templates\nic_ip_none_dns_none.json" />
<Content Include="command_modules\azure-cli-vm\azure\cli\command_modules\vm\mgmt\nested_templates\vm_existing_password.json" />
<Content Include="command_modules\azure-cli-vm\azure\cli\command_modules\vm\mgmt\nested_templates\vm_existing_sshkey.json" />
<Content Include="command_modules\azure-cli-vm\azure\cli\command_modules\vm\mgmt\nested_templates\vm_none_password.json" />
<Content Include="command_modules\azure-cli-vm\azure\cli\command_modules\vm\mgmt\nested_templates\vm_none_sshkey.json" />
<Content Include="command_modules\azure-cli-vm\azure\cli\command_modules\vm\mgmt\swagger_create_vm.json" />
<Content Include="command_modules\azure-cli-vm\azure\cli\command_modules\vm\tests\aliases.json" />
<Content Include="command_modules\azure-cli-vm\requirements.txt" />
</ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,15 @@ def __call__(self, parser, namespace, values, option_string=None):
else:
namespace.ssh_key_value = ssh_value

class VMDNSNameAction(argparse.Action): #pylint: disable=too-few-public-methods
def __call__(self, parser, namespace, values, option_string=None):
dns_value = values

if dns_value:
namespace.dns_name_type = 'new'

namespace.dns_name_for_public_ip = dns_value

extra_parameters = [
{
'name': '--image',
Expand All @@ -229,6 +238,14 @@ def __call__(self, parser, namespace, values, option_string=None):
{
'name': '--ssh-key-value',
'action': VMSSHFieldAction
},
{
'name': '--dns-name-for-public-ip',
'action': VMDNSNameAction
},
{
'name': '--dns-name-type',
'help': argparse.SUPPRESS
}
]

Expand All @@ -242,8 +259,8 @@ def __call__(self, parser, namespace, values, option_string=None):
required: false
short-summary: OS image (Common, URN or URI).
long-summary: |
Common OS types: CentOS, CoreOS, Debian, openSUSE, RHEL, SLES, UbuntuLTS, Win2012R2Datacenter, Win2012Datacenter, Win2008R2SP1
Example URN: canonical:Ubuntu_Snappy_Core:15.04:2016.0318.1949
Common OS types: Win2012R2Datacenter, Win2012Datacenter, Win2008SP1, or Offer from 'az vm image list'
Example URN: MicrosoftWindowsServer:WindowsServer:2012-R2-Datacenter:latest
Example URI: http://<storageAccount>.blob.core.windows.net/vhds/osdiskimage.vhd
populator-commands:
- az vm image list
Expand All @@ -261,7 +278,7 @@ def __call__(self, parser, namespace, values, option_string=None):
-l "West US" -g myvms --name myvm001 --public-ip-address-type new --dns-name-for-public-ip myGloballyUniqueVmDnsName
- 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 canonical:Ubuntu_Snappy_Core:15.04:2016.0318.1949
az vm create --image <linux image from 'az vm image list'>
--admin-username myadmin --admin-password Admin_001 --authentication-type sshkey
--virtual-network-type existing --virtual-network-name myvnet --subnet-name default
--availability-set-type existing --availability-set-id myavailset
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,13 +123,6 @@
"type": "string",
"defaultValue": "Win2012R2Datacenter",
"allowedValues": [
"CentOS",
"CoreOS",
"Debian",
"openSUSE",
"RHEL",
"SLES",
"UbuntuLTS",
"Win2012R2Datacenter",
"Win2012Datacenter",
"Win2008R2SP1",
Expand Down Expand Up @@ -282,55 +275,27 @@
},
"variables": {
"imagePublishers": {
"CoreOS": "CoreOS",
"Win2012R2Datacenter": "MicrosoftWindowsServer",
"Win2012Datacenter": "MicrosoftWindowsServer",
"Win2008R2SP1": "MicrosoftWindowsServer",
"Debian": "credativ",
"RHEL": "RedHat",
"CentOS": "OpenLogic",
"openSUSE": "SUSE",
"UbuntuLTS": "Canonical",
"SLES": "SUSE",
"Custom": "[parameters('osPublisher')]"
},
"imageOffers": {
"CoreOS": "CoreOS",
"Win2012R2Datacenter": "WindowsServer",
"Win2012Datacenter": "WindowsServer",
"Win2008R2SP1": "WindowsServer",
"Debian": "Debian",
"RHEL": "RHEL",
"CentOS": "CentOS",
"openSUSE": "openSUSE",
"UbuntuLTS": "UbuntuServer",
"SLES": "SLES",
"Custom": "[parameters('osOffer')]"
},
"imageSkus": {
"CoreOS": "Stable",
"Win2012R2Datacenter": "2012-R2-Datacenter",
"Win2012Datacenter": "2012-Datacenter",
"Win2008R2SP1": "2008-R2-SP1",
"Debian": "8",
"RHEL": "7.2",
"CentOS": "7.2",
"openSUSE": "13.2",
"UbuntuLTS": "14.04.4-LTS",
"SLES": "12-SP1",
"Custom": "[parameters('osSKU')]"
},
"imageVersions": {
"CoreOS": "latest",
"Win2012R2Datacenter": "latest",
"Win2012Datacenter": "latest",
"Win2008R2SP1": "latest",
"Debian": "latest",
"RHEL": "latest",
"CentOS": "latest",
"openSUSE": "latest",
"UbuntuLTS": "latest",
"SLES": "latest",
"Custom": "[parameters('osVersion')]"
},
"vnetDeploymentName": "[concat('VNet', variables('vmName'))]",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,16 @@ class DeploymentVM(Model):
the template.
:type content_version: str
:param storage_container_name: Name of storage container for the VM OS
disk.
disk. Default value: "vhds" .
:type storage_container_name: str
:param virtual_network_name: Name of virtual network to add VM to.
:type virtual_network_name: str
:param subnet_ip_address_prefix: The subnet address prefix in CIDR format.
:param subnet_ip_address_prefix: The subnet address prefix in CIDR
format. Default value: "10.0.0.0/24" .
:type subnet_ip_address_prefix: str
:param private_ip_address_allocation: Private IP address allocation
method.
method. Possible values include: 'Dynamic', 'Static'. Default value:
"Dynamic" .
:type private_ip_address_allocation: str
:param dns_name_for_public_ip: Globally unique DNS Name for the Public IP
used to access the Virtual Machine. Requires a new public IP to be
Expand All @@ -56,25 +58,26 @@ class DeploymentVM(Model):
:param admin_password: Password for the Virtual Machine. Required if SSH
(Linux only) is not specified.
:type admin_password: str
:param os_sku: The OS SKU to install.
:param os_sku: The OS SKU to install. Default value: "2012-R2-Datacenter"
.
:type os_sku: str
:param subnet_name: The subnet name.
:type subnet_name: str
:param os_type: Common OS choices. Choose 'Custom' to specify an image
with the osPublisher, osOffer, osSKU, and osVersion parameters. Possible
values include: 'CentOS', 'CoreOS', 'Debian', 'openSUSE', 'RHEL',
'SLES', 'UbuntuLTS', 'Win2012R2Datacenter', 'Win2012Datacenter',
values include: 'Win2012R2Datacenter', 'Win2012Datacenter',
'Win2008R2SP1', 'Custom'. Default value: "Win2012R2Datacenter" .
:type os_type: str
:param admin_username: Username for the Virtual Machine.
:type admin_username: str
:param os_version: The OS version to install.
:param os_version: The OS version to install. Default value: "latest" .
:type os_version: str
:param os_disk_name: Name of new VM OS disk.
:param os_disk_name: Name of new VM OS disk. Default value: "osdiskimage"
.
:type os_disk_name: str
:param ssh_dest_key_path: VM file path for SSH key.
:type ssh_dest_key_path: str
:param os_offer: The OS Offer to install.
:param os_offer: The OS Offer to install. Default value: "WindowsServer" .
:type os_offer: str
:param public_ip_address_allocation: Public IP address allocation method.
Possible values include: 'Dynamic', 'Static'. Default value: "Dynamic" .
Expand All @@ -97,15 +100,16 @@ class DeploymentVM(Model):
"none" .
:type public_ip_address_type: str
:param virtual_network_ip_address_prefix: The virtual network IP address
prefix in CIDR format.
prefix in CIDR format. Default value: "10.0.0.0/16" .
:type virtual_network_ip_address_prefix: str
:param availability_set_id: Existing availability set for the VM.
:type availability_set_id: str
:param ssh_key_value: SSH key file data.
:type ssh_key_value: str
:param location: Location for VM resources.
:type location: str
:param os_publisher: The OS publisher of the OS image.
:param os_publisher: The OS publisher of the OS image. Default value:
"MicrosoftWindowsServer" .
:type os_publisher: str
:param availability_set_type: Flag to add the VM to an existing
availability set. Possible values include: 'none', 'existing'. Default
Expand Down Expand Up @@ -174,7 +178,7 @@ class DeploymentVM(Model):

mode = "Incremental"

def __init__(self, name, admin_username, content_version=None, storage_container_name=None, virtual_network_name=None, subnet_ip_address_prefix=None, private_ip_address_allocation=None, dns_name_for_public_ip=None, storage_account_type="new", os_disk_uri=None, virtual_network_type="new", admin_password=None, os_sku=None, subnet_name=None, os_type="Win2012R2Datacenter", os_version=None, os_disk_name=None, ssh_dest_key_path=None, os_offer=None, 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=None, availability_set_id=None, ssh_key_value=None, location=None, os_publisher=None, availability_set_type="none", public_ip_address_name=None, dns_name_type="none"):
def __init__(self, name, admin_username, 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", 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"):
self.content_version = content_version
self.storage_container_name = storage_container_name
self.virtual_network_name = virtual_network_name
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ def __init__(self, client, config, serializer, deserializer):
self.config = config

def create_or_update(
self, resource_group_name, deployment_name, name, admin_username, content_version=None, storage_container_name=None, virtual_network_name=None, subnet_ip_address_prefix=None, private_ip_address_allocation=None, dns_name_for_public_ip=None, storage_account_type="new", os_disk_uri=None, virtual_network_type="new", admin_password=None, os_sku=None, subnet_name=None, os_type="Win2012R2Datacenter", os_version=None, os_disk_name=None, ssh_dest_key_path=None, os_offer=None, 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=None, availability_set_id=None, ssh_key_value=None, location=None, os_publisher=None, 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, admin_username, 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", 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):
"""
Create or update a virtual machine.

Expand All @@ -57,7 +57,7 @@ def create_or_update(
format.
:type subnet_ip_address_prefix: str
:param private_ip_address_allocation: Private IP address allocation
method.
method. Possible values include: 'Dynamic', 'Static'
:type private_ip_address_allocation: str
:param dns_name_for_public_ip: Globally unique DNS Name for the
Public IP used to access the Virtual Machine. Requires a new public
Expand All @@ -81,8 +81,7 @@ def create_or_update(
:type subnet_name: str
:param os_type: Common OS choices. Choose 'Custom' to specify an
image with the osPublisher, osOffer, osSKU, and osVersion
parameters. Possible values include: 'CentOS', 'CoreOS', 'Debian',
'openSUSE', 'RHEL', 'SLES', 'UbuntuLTS', 'Win2012R2Datacenter',
parameters. Possible values include: 'Win2012R2Datacenter',
'Win2012Datacenter', 'Win2008R2SP1', 'Custom'
:type os_type: str
:param os_version: The OS version to install.
Expand Down
Loading