When I do (in linux command line):
azure vm create Machine 0b11de9248dd4d87b18621318e037d37__RightImage-CentOS-7.0-x64-v14.2.1 USER passuser --location "West Europe"
there is always a line with "+ Creating cloud service"
how can i do without creating a new cloud service and use one that just exist?
Based on the documentation here, please try with -c or -connect option.
From the documentation page:
vm create [options] [password]
This command creates a new Azure virtual machine. By default, each
virtual machine (vm) is created in its own cloud service; however, you
can specify that a virtual machine should be added to an existing
cloud service through use of the -c option as documented here.
Related
How to check if a backup is enabled on an azure virtual machine using PowerShell or azure command
in my use case, I don't want to go with Get-AzureRmRecoveryServicesBackupContainer stuff, looking for any other option available on the virtual machine level for checking backup status of a VM.
Thanks
There is pretty much nothing on the az vm cli for what you are looking for.
To check directly on the vm level, you need https://learn.microsoft.com/en-us/powershell/module/az.recoveryservices/Get-AzRecoveryServicesBackupStatus?view=azps-3.0.0
Thus you will get the BackedUp property to check if your vm is being backed up.
In type parameter, you need to use AzureVM value. Name and resource group I need not explain.
I have about 200+ VMs (Windows & Linux) already deployed in Azure. I want to know if it is possible to use either Powershell or Azure CLI to update the VMs to use KeyVault as a password/key manager.
It is possible. You could use az vm update -n shui -g shuikeyvault --set to configure it. You could check this answer.
In fact, you could create a VM to use Key Vault, then use az vm show to get this parameters and use az vm update --set.
I'm looking for a way to run a script, on a single instance of a cloud service (which has several instances) from a remote machine.
I've tried DSC but that doesn't seem to support running the script only on one machine, as it would run it on all machines of the cloud service.
Note I'm using classic Azure cloud services.
Update: I specifically have an issue with Get-AzureVM which is part of the script example.
How do I get the instance VM which is part of my cloud service.
For instance I tried:
Get-AzureVM -ServiceName myCloudServiceName -Name instanceVMName
And that didn't return anything (I made sure to Add-AzureAccount first).
I’m assuming it returns nothing because Get-AzureVM cannot be used for cloud services, and only for VMs.
I’m able to get the instance by running
$dep = Get-AzureDeployment -ServiceName myCloudServiceName -Slot Production
$dep.RoleInstanceList[0]
Which returns role instance type which is different from the expected VM type.
Any ideas?
Powershell Remoting in Azure Cloud Services
As you are using a single instance the above should do the trick, you will need to create the user as part of a startup script, otherwise it will disappear each time it recreates the VM. It will not work if you every scale out to more than one instance of a cloud service.
You could use Custom Script extension for Windows virtual machines. It supports run on a single VM.
With the Custom Script extension for Windows, you can run PowerShell scripts on a remote VM without signing in to it. You can run the scripts after provisioning the VM, or at any time during the lifecycle of the VM without opening any additional ports. The most common use cases for running Custom Script extension include running, installing, and configuring additional software on the VM after it's provisioned.
More information please refer to this link.
Has anyone been able to create a VM with multiple private IP's in ARM? I've tried setting different VM sizes but still cannot find out how to attach multiple NIC's to 1 VM. I'm trying to do this in the new ARM mode but cannot find a way to do so.
Thanks!
You can only add multiple network interface resources to a VM using PowerShell or JSON, and it can only be done during VM creation.
The nics have to have been created before hand and you have to choose a vm which supports multiple NICs. Also, Create a virtual network with one subnet must have been created before hand as well.
Using Azure Cli 2.0
azure login
azure config mode arm
azure vm create -g myresourcegroup -n myVMname -l AzureLocation -y {windows|linux} -N myNic1, myNic2 -Q Win2012R2Datacenter -u myUserName -p myPassword -z ‘AzureVM Size’ -v
Wait 5 minutes
and you are done
I'm looking to create endpoints (if that's what its still being called) using the Resource Management deployment mode (arm mode). I am currently using Resource Management deployment mode to create virtual machines in Azure since every article practically recommends that as the preferred way. I created an Ubuntu Linux VM in Azure in hopes to really use Azure as a cloud platform for Linux VMs. Despite the new azure portal constantly evolving (with documentations that could surely improve), I managed to create endpoints via Network Security Group (NSG) resource using the new azure portal. However, I am still unable to create endpoints (if that's what its even called anymore) via the Azure CLI... I just get "error: 'endpoint' is not an azure command. See 'azure help'." message. I've read the Azure docs enough to know that I need to execute azure login command and also execute azure config mode arm command since I used the Resource Management deployment mode to create my vm. when I enter the command azure vm --help, I don't see information regarding vm create endpoint, which leads me to believe this command is not supported for Resource Management mode.
How would I create endpoints, or more specifically Inbound security rules, using Azure CLI if I created an Ubuntu Linux VM using Resource Management deployment mode?
In ARM mode, endpoint is not available for VM. Instead, you can add a inbound rule to your ARM Network Security Group. Here is how it looks like.
azure network nsg rule create --protocol tcp --direction inbound --priority 1000 \
--destination-port-range 22 --access allow -g TestRG -a TestNSG -n SSHRule
The above command add a rule to the NSQ named TestNSG in resource group TestRG. The rule is named SSHRule which allows TCP inbound traffic through the port 22 with priority 1000.
For more information, see the "Manage rules" of "Manage NSGs using the Azure CLI"