diff --git a/src/Common/Commands.Common.Storage/Commands.Common.Storage.csproj b/src/Common/Commands.Common.Storage/Commands.Common.Storage.csproj index 9e48f6ab0fc5..748611cb7750 100644 --- a/src/Common/Commands.Common.Storage/Commands.Common.Storage.csproj +++ b/src/Common/Commands.Common.Storage/Commands.Common.Storage.csproj @@ -67,6 +67,10 @@ ..\..\packages\Microsoft.Azure.KeyVault.Core.1.0.0\lib\net40\Microsoft.Azure.KeyVault.Core.dll True + + ..\..\packages\Microsoft.Azure.Management.Compute.9.1.0\lib\net40\Microsoft.Azure.Management.Compute.dll + True + ..\..\packages\Microsoft.Azure.Management.Storage.2.4.0-preview\lib\net40\Microsoft.Azure.Management.Storage.dll True diff --git a/src/Common/Commands.Common.Storage/packages.config b/src/Common/Commands.Common.Storage/packages.config index 3f29d76db862..b16b567cf231 100644 --- a/src/Common/Commands.Common.Storage/packages.config +++ b/src/Common/Commands.Common.Storage/packages.config @@ -5,6 +5,7 @@ + diff --git a/src/Common/Commands.Common/Commands.Common.csproj b/src/Common/Commands.Common/Commands.Common.csproj index 7c3648a89ffe..196d61c5875a 100644 --- a/src/Common/Commands.Common/Commands.Common.csproj +++ b/src/Common/Commands.Common/Commands.Common.csproj @@ -70,6 +70,10 @@ False ..\..\packages\Microsoft.Azure.Common.2.1.0\lib\net45\Microsoft.Azure.Common.NetFramework.dll + + ..\..\packages\Microsoft.Azure.Management.Compute.9.1.0\lib\net40\Microsoft.Azure.Management.Compute.dll + True + False ..\..\packages\Microsoft.Azure.Management.Resources.2.18.7-preview\lib\net40\Microsoft.Azure.ResourceManager.dll diff --git a/src/Common/Commands.Common/packages.config b/src/Common/Commands.Common/packages.config index 3f25db8f5500..6a43e49ff0b8 100644 --- a/src/Common/Commands.Common/packages.config +++ b/src/Common/Commands.Common/packages.config @@ -6,6 +6,7 @@ + diff --git a/src/Common/Storage/Commands.Storage/Commands.Storage.csproj b/src/Common/Storage/Commands.Storage/Commands.Storage.csproj index 7a7ad9531f60..ec145c493a87 100644 --- a/src/Common/Storage/Commands.Storage/Commands.Storage.csproj +++ b/src/Common/Storage/Commands.Storage/Commands.Storage.csproj @@ -61,6 +61,10 @@ ..\..\..\packages\Microsoft.Azure.KeyVault.Core.1.0.0\lib\net40\Microsoft.Azure.KeyVault.Core.dll True + + ..\..\..\packages\Microsoft.Azure.Management.Compute.9.1.0\lib\net40\Microsoft.Azure.Management.Compute.dll + True + False ..\..\..\packages\Microsoft.Azure.Management.Resources.2.18.7-preview\lib\net40\Microsoft.Azure.ResourceManager.dll diff --git a/src/Common/Storage/Commands.Storage/packages.config b/src/Common/Storage/Commands.Storage/packages.config index 26ec9394c081..261d6d5d5faa 100644 --- a/src/Common/Storage/Commands.Storage/packages.config +++ b/src/Common/Storage/Commands.Storage/packages.config @@ -5,6 +5,7 @@ + diff --git a/src/ResourceManager/Common/Commands.ResourceManager.Common/Commands.ResourceManager.Common.csproj b/src/ResourceManager/Common/Commands.ResourceManager.Common/Commands.ResourceManager.Common.csproj index d09ed7111490..074e63b711e4 100644 --- a/src/ResourceManager/Common/Commands.ResourceManager.Common/Commands.ResourceManager.Common.csproj +++ b/src/ResourceManager/Common/Commands.ResourceManager.Common/Commands.ResourceManager.Common.csproj @@ -68,6 +68,10 @@ False ..\..\..\packages\Microsoft.Azure.Common.2.1.0\lib\net45\Microsoft.Azure.Common.NetFramework.dll + + ..\..\..\packages\Microsoft.Azure.Management.Compute.9.1.0\lib\net40\Microsoft.Azure.Management.Compute.dll + True + False ..\..\..\packages\Microsoft.IdentityModel.Clients.ActiveDirectory.2.18.206251556\lib\net45\Microsoft.IdentityModel.Clients.ActiveDirectory.dll diff --git a/src/ResourceManager/Common/Commands.ResourceManager.Common/packages.config b/src/ResourceManager/Common/Commands.ResourceManager.Common/packages.config index f6c5a3d0671d..1994a67ef9f4 100644 --- a/src/ResourceManager/Common/Commands.ResourceManager.Common/packages.config +++ b/src/ResourceManager/Common/Commands.ResourceManager.Common/packages.config @@ -6,6 +6,7 @@ + diff --git a/src/ResourceManager/Common/Commands.ScenarioTests.ResourceManager.Common/Commands.ScenarioTests.ResourceManager.Common.csproj b/src/ResourceManager/Common/Commands.ScenarioTests.ResourceManager.Common/Commands.ScenarioTests.ResourceManager.Common.csproj index 785dea47f858..144288429542 100644 --- a/src/ResourceManager/Common/Commands.ScenarioTests.ResourceManager.Common/Commands.ScenarioTests.ResourceManager.Common.csproj +++ b/src/ResourceManager/Common/Commands.ScenarioTests.ResourceManager.Common/Commands.ScenarioTests.ResourceManager.Common.csproj @@ -52,6 +52,10 @@ ..\..\..\packages\Microsoft.Azure.Common.2.1.0\lib\net45\Microsoft.Azure.Common.NetFramework.dll + + ..\..\..\packages\Microsoft.Azure.Management.Compute.9.1.0\lib\net40\Microsoft.Azure.Management.Compute.dll + True + False ..\..\..\packages\Microsoft.Azure.Management.Resources.2.18.7-preview\lib\net40\Microsoft.Azure.ResourceManager.dll diff --git a/src/ResourceManager/Common/Commands.ScenarioTests.ResourceManager.Common/packages.config b/src/ResourceManager/Common/Commands.ScenarioTests.ResourceManager.Common/packages.config index 1c8ddf97ddd2..46d9d3ed9638 100644 --- a/src/ResourceManager/Common/Commands.ScenarioTests.ResourceManager.Common/packages.config +++ b/src/ResourceManager/Common/Commands.ScenarioTests.ResourceManager.Common/packages.config @@ -4,6 +4,7 @@ + diff --git a/src/ResourceManager/Compute/Commands.Compute.Test/Commands.Compute.Test.csproj b/src/ResourceManager/Compute/Commands.Compute.Test/Commands.Compute.Test.csproj index a3eb4dd49c90..df7e94e8c616 100644 --- a/src/ResourceManager/Compute/Commands.Compute.Test/Commands.Compute.Test.csproj +++ b/src/ResourceManager/Compute/Commands.Compute.Test/Commands.Compute.Test.csproj @@ -69,6 +69,7 @@ False ..\..\..\packages\Microsoft.Azure.Management.Compute.9.1.0\lib\net40\Microsoft.Azure.Management.Compute.dll + True False diff --git a/src/ResourceManager/Compute/Commands.Compute.Test/ScenarioTests/VirtualMachineExtensionTests.cs b/src/ResourceManager/Compute/Commands.Compute.Test/ScenarioTests/VirtualMachineExtensionTests.cs index 31997db0f2a6..2cdc0915a376 100644 --- a/src/ResourceManager/Compute/Commands.Compute.Test/ScenarioTests/VirtualMachineExtensionTests.cs +++ b/src/ResourceManager/Compute/Commands.Compute.Test/ScenarioTests/VirtualMachineExtensionTests.cs @@ -53,5 +53,13 @@ public void TestVirtualMachineAccessExtension() { ComputeTestController.NewInstance.RunPsTest("Test-VirtualMachineAccessExtension"); } + + [Fact(Skip = "TODO: only works for live mode")] + [Trait(Category.RunType, Category.LiveOnly)] + public void TestAzureDiskEncryptionExtension() + { + ComputeTestController.NewInstance.RunPsTest("Test-AzureDiskEncryptionExtension"); + } + } } diff --git a/src/ResourceManager/Compute/Commands.Compute.Test/ScenarioTests/VirtualMachineExtensionTests.ps1 b/src/ResourceManager/Compute/Commands.Compute.Test/ScenarioTests/VirtualMachineExtensionTests.ps1 index 13bb21cb3229..4cac10de3462 100644 --- a/src/ResourceManager/Compute/Commands.Compute.Test/ScenarioTests/VirtualMachineExtensionTests.ps1 +++ b/src/ResourceManager/Compute/Commands.Compute.Test/ScenarioTests/VirtualMachineExtensionTests.ps1 @@ -790,3 +790,138 @@ function Test-VirtualMachineAccessExtension Clean-ResourceGroup $rgname } } + +<# +.SYNOPSIS +Test AzureDiskEncryption extension +#> +function Test-AzureDiskEncryptionExtension +{ + # This test should be run in Live mode only not in Playback mode + #Pre-requisites to be filled in before running this test. The AAD app should belong to the directory as the user running the test. + $aadClientID = ""; + $aadClientSecret = ""; + #Fill in VM admin user and password + $adminUser = ""; + $adminPassword = ""; + + #Resource group variables + $rgName = "detestrg"; + $loc = "South Central US"; + + #KeyVault config variables + $vaultName = "detestvault"; + $kekName = "dstestkek"; + + #VM config variables + $vmName = "detestvm"; + $vmsize = 'Standard_D2'; + $imagePublisher = "MicrosoftWindowsServer"; + $imageOffer = "WindowsServer"; + $imageSku ="2012-R2-Datacenter"; + + #Storage config variables + $storageAccountName = "deteststore"; + $stotype = 'Standard_LRS'; + $vhdContainerName = "vhds"; + $osDiskName = 'osdisk' + $vmName; + $dataDiskName = 'datadisk' + $vmName; + $osDiskCaching = 'ReadWrite'; + + #Network config variables + $vnetName = "detestvnet"; + $subnetName = "detestsubnet"; + $publicIpName = 'pubip' + $vmName; + $nicName = 'nic' + $vmName; + + + #Disk encryption variables + $keyEncryptionAlgorithm = "RSA-OAEP"; + $volumeType = "All"; + + try + { + Login-AzureRmAccount; + # Create new resource group + New-AzureRmResourceGroup -Name $rgname -Location $loc -Force; + + # Create new KeyVault + $keyVault = New-AzureRmKeyVault -VaultName $vaultName -ResourceGroupName $rgname -Location $loc -Sku standard; + $keyVault = Get-AzureRmKeyVault -VaultName $vaultName -ResourceGroupName $rgname + #set enabledForDiskEncryption + Write-Host 'Press go to https://resources.azure.com and set enabledForDiskEncryption flag on KeyVault. [ENTER] to continue or [CTRL-C] to abort...' + Read-Host + #set permissions to AAD app to write secrets and keys + Set-AzureRmKeyVaultAccessPolicy -VaultName $vaultName -ServicePrincipalName $aadClientID -PermissionsToKeys all -PermissionsToSecrets all + #create a key in KeyVault to use as Kek + $kek = Add-AzureKeyVaultKey -VaultName $vaultName -Name $kekName -Destination "Software" + + $diskEncryptionKeyVaultUrl = $keyVault.VaultUri; + $keyVaultResourceId = $keyVault.ResourceId; + $keyEncryptionKeyUrl = $kek.Key.kid; + + # VM Profile & Hardware + $p = New-AzureRmVMConfig -VMName $vmname -VMSize $vmsize; + + # NRP + $subnet = New-AzureRmVirtualNetworkSubnetConfig -Name ($subnetName) -AddressPrefix "10.0.0.0/24"; + $vnet = New-AzureRmVirtualNetwork -Force -Name ($vnetName) -ResourceGroupName $rgname -Location $loc -AddressPrefix "10.0.0.0/16" -Subnet $subnet; + $vnet = Get-AzureRmVirtualNetwork -Name ($vnetName) -ResourceGroupName $rgname; + $subnetId = $vnet.Subnets[0].Id; + $pubip = New-AzureRmPublicIpAddress -Force -Name ($publicIpName) -ResourceGroupName $rgname -Location $loc -AllocationMethod Dynamic -DomainNameLabel ($publicIpName); + $pubip = Get-AzureRmPublicIpAddress -Name ($publicIpName) -ResourceGroupName $rgname; + $pubipId = $pubip.Id; + $nic = New-AzureRmNetworkInterface -Force -Name ($nicName) -ResourceGroupName $rgname -Location $loc -SubnetId $subnetId -PublicIpAddressId $pubip.Id; + $nic = Get-AzureRmNetworkInterface -Name ($nicName) -ResourceGroupName $rgname; + $nicId = $nic.Id; + + $p = Add-AzureRmVMNetworkInterface -VM $p -Id $nicId; + + # Storage Account (SA) + New-AzureRmStorageAccount -ResourceGroupName $rgname -Name $storageAccountName -Location $loc -Type $stotype; + $stokey = (Get-AzureRmStorageAccountKey -ResourceGroupName $rgname -Name $storageAccountName).Key1; + + $osDiskVhdUri = "https://$storageAccountName.blob.core.windows.net/$vhdContainerName/$osDiskName.vhd"; + $dataDiskVhdUri = "https://$storageAccountName.blob.core.windows.net/$vhdContainerName/$dataDiskName.vhd"; + + $p = Set-AzureRmVMOSDisk -VM $p -Name $osDiskName -VhdUri $osDiskVhdUri -Caching $osDiskCaching -CreateOption FromImage; + $p = Add-AzureRmVMDataDisk -VM $p -Name $dataDiskName -Caching 'ReadOnly' -DiskSizeInGB 2 -Lun 1 -VhdUri $dataDiskVhdUri -CreateOption Empty; + + # OS & Image + $securePassword = ConvertTo-SecureString $adminPassword -AsPlainText -Force; + $cred = New-Object System.Management.Automation.PSCredential ($adminUser, $securePassword); + $computerName = $vmName; + $vhdContainer = "https://$storageAccountName.blob.core.windows.net/$vhdContainerName"; + + $p = Set-AzureRmVMOperatingSystem -VM $p -Windows -ComputerName $computerName -Credential $cred -ProvisionVMAgent; + $p = Set-AzureRmVMSourceImage -VM $p -PublisherName $imagePublisher -Offer $imageOffer -Skus $imageSku -Version "latest"; + + + # Virtual Machine + New-AzureRmVM -ResourceGroupName $rgname -Location $loc -VM $p; + + #Enable encryption on the VM + Set-AzureRmVMDiskEncryptionExtension -ResourceGroupName $rgname -VMName $vmName -AadClientID $aadClientID -AadClientSecret $aadClientSecret -DiskEncryptionKeyVaultUrl $diskEncryptionKeyVaultUrl -DiskEncryptionKeyVaultId $keyVaultResourceId -KeyEncryptionKeyUrl $keyEncryptionKeyUrl -KeyEncryptionKeyVaultId $keyVaultResourceId -Force; + #Get encryption status + $encryptionStatus = Get-AzureRmVmDiskEncryptionStatus -ResourceGroupName $rgname -VMName $vmName; + #Remove AzureDiskEncryption extension + Remove-AzureRmVMDiskEncryptionExtension -ResourceGroupName $rgname -VMName $vmName; + + #Remove the VM + Remove-AzureRmVm -ResourceGroupName $rgname -Name $vmName -Force; + + #Create a brand new VM using the same OS vhd encrypted above + $p.StorageProfile.ImageReference = $null; + $p.OSProfile = $null; + $p.StorageProfile.DataDisks = $null; + $p = Set-AzureRmVMOSDisk -VM $p -Name $p.StorageProfile.OSDisk.Name -VhdUri $p.StorageProfile.OSDisk.VirtualHardDisk.Uri -Caching ReadWrite -CreateOption attach -DiskEncryptionKeyUrl $encryptionStatus.OsVolumeEncryptionSettings.DiskEncryptionKey.SecretUrl -DiskEncryptionKeyVaultId $encryptionStatus.OsVolumeEncryptionSettings.DiskEncryptionKey.SourceVault.ReferenceUri -Windows; + + New-AzureRmVM -ResourceGroupName $rgname -Location $loc -VM $p; + + } + finally + { + # Cleanup + Remove-AzureRmResourceGroup -Name $rgname -Force; + } +} diff --git a/src/ResourceManager/Compute/Commands.Compute/Commands.Compute.csproj b/src/ResourceManager/Compute/Commands.Compute/Commands.Compute.csproj index 5c6f94e7284b..005825aac5aa 100644 --- a/src/ResourceManager/Compute/Commands.Compute/Commands.Compute.csproj +++ b/src/ResourceManager/Compute/Commands.Compute/Commands.Compute.csproj @@ -204,6 +204,19 @@ + + + + + + + + + + + + + @@ -239,6 +252,7 @@ + diff --git a/src/ResourceManager/Compute/Commands.Compute/Common/ConstantStringTypes.cs b/src/ResourceManager/Compute/Commands.Compute/Common/ConstantStringTypes.cs index ea3505f24485..2643ed069793 100644 --- a/src/ResourceManager/Compute/Commands.Compute/Common/ConstantStringTypes.cs +++ b/src/ResourceManager/Compute/Commands.Compute/Common/ConstantStringTypes.cs @@ -114,5 +114,14 @@ public static class ProfileNouns // Sql Server public const string VirtualMachineSqlServerExtension = "AzureRmVMSqlServerExtension"; + + //AzureDiskEncryption + public const string AzureDiskEncryptionExtension = "AzureRmVMDiskEncryptionExtension"; + public const string AzureDiskEncryptionStatus = "AzureRmVMDiskEncryptionStatus"; + + //AzureVMBackup + public const string AzureVMBackup = "AzureRmVMBackup"; + public const string AzureVMBackupExtension = "AzureRmVMBackupExtension"; + } } diff --git a/src/ResourceManager/Compute/Commands.Compute/Extension/AzureDiskEncryption/AzureDiskEncryptionExtensionContext.cs b/src/ResourceManager/Compute/Commands.Compute/Extension/AzureDiskEncryption/AzureDiskEncryptionExtensionContext.cs new file mode 100644 index 000000000000..82fd017da1ab --- /dev/null +++ b/src/ResourceManager/Compute/Commands.Compute/Extension/AzureDiskEncryption/AzureDiskEncryptionExtensionContext.cs @@ -0,0 +1,99 @@ +// ---------------------------------------------------------------------------------- +// +// Copyright Microsoft Corporation +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// ---------------------------------------------------------------------------------- + +using Newtonsoft.Json; +using System.Security; +using Microsoft.Azure.Commands.Compute.Models; + +namespace Microsoft.Azure.Commands.Compute.Extension.AzureDiskEncryption +{ + /// + /// This class represents the extension context of AzureDiskEncryption VM extension. This is returned as an output of Get-AzureDiskEncryption cmdlet + /// + public class AzureDiskEncryptionExtensionContext : PSVirtualMachineExtension + { + public const string LinuxExtensionDefaultPublisher = "Microsoft.OSTCExtensions"; + public const string LinuxExtensionDefaultName = "AzureDiskEncryptionForLinux"; + public const string LinuxExtensionDefaultVersion = "0.1"; + + public const string ExtensionDefaultPublisher = "Microsoft.Azure.Security"; + public const string ExtensionDefaultName = "AzureDiskEncryption"; + public const string ExtensionDefaultVersion = "1.0"; + public const string VolumeTypeOS = "OS"; + public const string VolumeTypeData = "Data"; + public const string VolumeTypeAll = "All"; + public const string StatusSucceeded = "Succeeded"; + + // Extension configuration + public string AadClientID { get; set; } + public SecureString AadClientSecret { get; set; } + public string KeyVaultURL { get; set; } + public string KeyEncryptionKeyURL { get; set; } + public string KeyEncryptionAlgorithm { get; set; } + public string VolumeType { get; set; } + public string AadClientCertThumbprint { get; set; } + public string SequenceVersion { get; set; } + public SecureString Passphrase { get; set; } + + private static SecureString ConvertStringToSecureString(string str) + { + if (string.IsNullOrWhiteSpace(str)) + return null; + SecureString secStr = new SecureString(); + foreach (char ch in str.ToCharArray()) + { + secStr.AppendChar(ch); + } + + return secStr; + } + + private void InitializeAzureDiskEncryptionMembers(PSVirtualMachineExtension psExt) + { + AzureDiskEncryptionExtensionPublicSettings publicSettings = string.IsNullOrEmpty(psExt.PublicSettings) ? null + : JsonConvert.DeserializeObject(psExt.PublicSettings); + + AzureDiskEncryptionExtensionProtectedSettings protectedSettings = string.IsNullOrEmpty(psExt.ProtectedSettings) ? null + : JsonConvert.DeserializeObject(psExt.ProtectedSettings); + + AadClientID = (publicSettings == null) ? null : publicSettings.AadClientID; + KeyVaultURL = (publicSettings == null) ? null : publicSettings.KeyVaultURL; + KeyEncryptionKeyURL = (publicSettings == null) ? null : publicSettings.KeyEncryptionKeyURL; + KeyEncryptionAlgorithm = (publicSettings == null) ? null : publicSettings.KeyEncryptionAlgorithm; + VolumeType = (publicSettings == null) ? null : publicSettings.VolumeType; + AadClientCertThumbprint = (publicSettings == null) ? null : publicSettings.AadClientCertThumbprint; + SequenceVersion = (publicSettings == null) ? null : publicSettings.SequenceVersion; + AadClientSecret = (protectedSettings == null) ? null : ConvertStringToSecureString(protectedSettings.AadClientSecret); + Passphrase = (protectedSettings == null) ? null : ConvertStringToSecureString(protectedSettings.Passphrase); + } + + public AzureDiskEncryptionExtensionContext(PSVirtualMachineExtension psExt) + { + ResourceGroupName = psExt.ResourceGroupName; + Name = psExt.Name; + Location = psExt.Location; + Etag = psExt.Etag; + Publisher = psExt.Publisher; + ExtensionType = psExt.ExtensionType; + TypeHandlerVersion = psExt.TypeHandlerVersion; + Id = psExt.Id; + PublicSettings = psExt.PublicSettings; + ProtectedSettings = psExt.ProtectedSettings; + ProvisioningState = psExt.ProvisioningState; + Statuses = psExt.Statuses; + + InitializeAzureDiskEncryptionMembers(psExt); + } + } +} \ No newline at end of file diff --git a/src/ResourceManager/Compute/Commands.Compute/Extension/AzureDiskEncryption/AzureDiskEncryptionExtensionProtectedSettings.cs b/src/ResourceManager/Compute/Commands.Compute/Extension/AzureDiskEncryption/AzureDiskEncryptionExtensionProtectedSettings.cs new file mode 100644 index 000000000000..857242d7dcab --- /dev/null +++ b/src/ResourceManager/Compute/Commands.Compute/Extension/AzureDiskEncryption/AzureDiskEncryptionExtensionProtectedSettings.cs @@ -0,0 +1,23 @@ +// ---------------------------------------------------------------------------------- +// +// Copyright Microsoft Corporation +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// ---------------------------------------------------------------------------------- + + +namespace Microsoft.Azure.Commands.Compute.Extension.AzureDiskEncryption +{ + class AzureDiskEncryptionExtensionProtectedSettings + { + public string AadClientSecret { get; set; } + public string Passphrase { get; set; } + } +} diff --git a/src/ResourceManager/Compute/Commands.Compute/Extension/AzureDiskEncryption/AzureDiskEncryptionExtensionPublicSettings.cs b/src/ResourceManager/Compute/Commands.Compute/Extension/AzureDiskEncryption/AzureDiskEncryptionExtensionPublicSettings.cs new file mode 100644 index 000000000000..80c8b25e3c19 --- /dev/null +++ b/src/ResourceManager/Compute/Commands.Compute/Extension/AzureDiskEncryption/AzureDiskEncryptionExtensionPublicSettings.cs @@ -0,0 +1,28 @@ +// ---------------------------------------------------------------------------------- +// +// Copyright Microsoft Corporation +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// ---------------------------------------------------------------------------------- + + +namespace Microsoft.Azure.Commands.Compute.Extension.AzureDiskEncryption +{ + public class AzureDiskEncryptionExtensionPublicSettings + { + public string AadClientID { get; set; } + public string KeyVaultURL { get; set; } + public string KeyEncryptionKeyURL { get; set; } + public string KeyEncryptionAlgorithm { get; set; } + public string VolumeType { get; set; } + public string AadClientCertThumbprint { get; set; } + public string SequenceVersion { get; set; } + } +} diff --git a/src/ResourceManager/Compute/Commands.Compute/Extension/AzureDiskEncryption/GetAzureDiskEncryptionStatus.cs b/src/ResourceManager/Compute/Commands.Compute/Extension/AzureDiskEncryption/GetAzureDiskEncryptionStatus.cs new file mode 100644 index 000000000000..085199b9cb42 --- /dev/null +++ b/src/ResourceManager/Compute/Commands.Compute/Extension/AzureDiskEncryption/GetAzureDiskEncryptionStatus.cs @@ -0,0 +1,153 @@ +// ---------------------------------------------------------------------------------- +// +// Copyright Microsoft Corporation +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// ---------------------------------------------------------------------------------- + +using Microsoft.Azure.Commands.Compute.Common; +using Microsoft.Azure.Commands.Compute.Models; +using Microsoft.Azure.Management.Compute; +using System; +using System.Management.Automation; +using Microsoft.Azure.Management.Compute.Models; +using System.Globalization; + +namespace Microsoft.Azure.Commands.Compute.Extension.AzureDiskEncryption +{ + [Cmdlet( + VerbsCommon.Get, + ProfileNouns.AzureDiskEncryptionStatus), + OutputType(typeof(AzureDiskEncryptionExtensionContext))] + public class GetAzureDiskEncryptionStatusCommand : VirtualMachineExtensionBaseCmdlet + { + [Parameter( + Mandatory = true, + Position = 0, + ValueFromPipelineByPropertyName = true, + HelpMessage = "Resource group name of the virtual machine")] + [ValidateNotNullOrEmpty] + public string ResourceGroupName { get; set; } + + [Alias("ResourceName")] + [Parameter( + Mandatory = true, + Position = 1, + ValueFromPipelineByPropertyName = true, + HelpMessage = "The virtual machine name.")] + [ValidateNotNullOrEmpty] + public string VMName { get; set; } + + private bool IsOsVolumeEncrypted(VirtualMachine vmParameters) + { + return (GetOsVolumeEncryptionSettings(vmParameters) != null); + } + + private DiskEncryptionSettings GetOsVolumeEncryptionSettings(VirtualMachine vmParameters) + { + if ((vmParameters != null) && + (vmParameters.StorageProfile != null) && + (vmParameters.StorageProfile.OSDisk != null)) + { + return vmParameters.StorageProfile.OSDisk.EncryptionSettings; + } + return null; + } + private bool IsAzureDiskEncryptionExtension(VirtualMachineExtension vmExtension) + { + if ((vmExtension != null) && + (vmExtension.Publisher != null) && + (vmExtension.ExtensionType != null) && + (vmExtension.Publisher.Equals(AzureDiskEncryptionExtensionContext.ExtensionDefaultPublisher, StringComparison.InvariantCultureIgnoreCase)) && + (vmExtension.ExtensionType.Equals(AzureDiskEncryptionExtensionContext.ExtensionDefaultName, StringComparison.InvariantCultureIgnoreCase))) + { + return true; + } + + return false; + } + + private bool DataVolumeInExtensionConfig(AzureDiskEncryptionExtensionContext adeExtension) + { + if (adeExtension != null) + { + if ((string.IsNullOrWhiteSpace(adeExtension.VolumeType)) || + (adeExtension.VolumeType.Equals(AzureDiskEncryptionExtensionContext.VolumeTypeData, StringComparison.InvariantCultureIgnoreCase)) || + (adeExtension.VolumeType.Equals(AzureDiskEncryptionExtensionContext.VolumeTypeAll, StringComparison.InvariantCultureIgnoreCase))) + { + return true; + } + } + + return false; + } + + private bool ExtensionProvisioningSucceeded(AzureDiskEncryptionExtensionContext adeExtension) + { + VirtualMachineExtensionGetResponse extensionStatusViewresult = this.VirtualMachineExtensionClient.GetWithInstanceView(this.ResourceGroupName, this.VMName, adeExtension.Name); + PSVirtualMachineExtension extensionStatusView = extensionStatusViewresult.ToPSVirtualMachineExtension(this.ResourceGroupName); + AzureDiskEncryptionExtensionContext adeExtensionWithStatus = new AzureDiskEncryptionExtensionContext(extensionStatusView); + if (adeExtensionWithStatus.ProvisioningState.Equals(AzureDiskEncryptionExtensionContext.StatusSucceeded, StringComparison.InvariantCultureIgnoreCase)) + { + return true; + } + + return false; + } + + private bool AreDataVolumesEncrypted(VirtualMachine vmParameters) + { + if (vmParameters == null || vmParameters.Extensions == null) + { + return false; + } + + foreach (VirtualMachineExtension vmExtension in vmParameters.Extensions) + { + if (IsAzureDiskEncryptionExtension(vmExtension)) + { + AzureDiskEncryptionExtensionContext adeExtension = new AzureDiskEncryptionExtensionContext(vmExtension.ToPSVirtualMachineExtension(this.ResourceGroupName)); + if (DataVolumeInExtensionConfig(adeExtension)) + { + if (ExtensionProvisioningSucceeded(adeExtension)) + { + return true; + } + } + } + } + + return false; + } + + protected override void ProcessRecord() + { + base.ProcessRecord(); + + ExecuteClientAction(() => + { + VirtualMachine vmParameters = (this.ComputeClient.ComputeManagementClient.VirtualMachines.Get(this.ResourceGroupName, this.VMName)).VirtualMachine; + + bool osVolumeEncrypted = IsOsVolumeEncrypted(vmParameters); + DiskEncryptionSettings osVolumeEncryptionSettings = GetOsVolumeEncryptionSettings(vmParameters); + bool dataVolumesEncrypted = AreDataVolumesEncrypted(vmParameters); + + AzureDiskEncryptionStatusContext encryptionStatus = new AzureDiskEncryptionStatusContext + { + OsVolumeEncrypted = osVolumeEncrypted, + OsVolumeEncryptionSettings = osVolumeEncryptionSettings, + DataVolumesEncrypted = dataVolumesEncrypted + }; + WriteObject(encryptionStatus); + }); + + } + } +} diff --git a/src/ResourceManager/Compute/Commands.Compute/Extension/AzureDiskEncryption/RemoveAzureDiskEncryptionExtension.cs b/src/ResourceManager/Compute/Commands.Compute/Extension/AzureDiskEncryption/RemoveAzureDiskEncryptionExtension.cs new file mode 100644 index 000000000000..1789d846578e --- /dev/null +++ b/src/ResourceManager/Compute/Commands.Compute/Extension/AzureDiskEncryption/RemoveAzureDiskEncryptionExtension.cs @@ -0,0 +1,85 @@ +// ---------------------------------------------------------------------------------- +// +// Copyright Microsoft Corporation +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// ---------------------------------------------------------------------------------- + +using Microsoft.Azure.Commands.Compute.Common; +using Microsoft.Azure.Management.Compute; +using Microsoft.Azure.Management.Compute.Models; +using System.Management.Automation; +using System; + +namespace Microsoft.Azure.Commands.Compute.Extension.AzureDiskEncryption +{ + [Cmdlet( + VerbsCommon.Remove, + ProfileNouns.AzureDiskEncryptionExtension)] + public class RemoveAzureDiskEncryptionExtensionCommand : VirtualMachineExtensionBaseCmdlet + { + [Parameter( + Mandatory = true, + Position = 0, + ValueFromPipelineByPropertyName = true, + HelpMessage = "The resource group name.")] + [ValidateNotNullOrEmpty] + public string ResourceGroupName { get; set; } + + [Alias("ResourceName")] + [Parameter( + Mandatory = true, + Position = 1, + ValueFromPipelineByPropertyName = true, + HelpMessage = "The virtual machine name.")] + [ValidateNotNullOrEmpty] + public string VMName { get; set; } + + [Alias("ExtensionName")] + [Parameter( + Mandatory = false, + Position = 2, + ValueFromPipelineByPropertyName = true, + HelpMessage = "The extension name. If this parameter is not specified, default values used are AzureDiskEncryption for windows VMs and AzureDiskEncryptionForLinux for Linux VMs")] + [ValidateNotNullOrEmpty] + public string Name { get; set; } + + [Parameter(HelpMessage = "To force the removal.")] + [ValidateNotNullOrEmpty] + public SwitchParameter Force { get; set; } + + protected override void ProcessRecord() + { + base.ProcessRecord(); + + ExecuteClientAction(() => + { + VirtualMachine virtualMachineResponse = (this.ComputeClient.ComputeManagementClient.VirtualMachines.Get(this.ResourceGroupName, this.VMName)).VirtualMachine; + + string currentOSType = virtualMachineResponse.StorageProfile.OSDisk.OperatingSystemType; + if (string.Equals(currentOSType, "Windows", StringComparison.InvariantCultureIgnoreCase)) + { + this.Name = this.Name ?? AzureDiskEncryptionExtensionContext.ExtensionDefaultName; + } + else if (string.Equals(currentOSType, "Linux", StringComparison.InvariantCultureIgnoreCase)) + { + this.Name = this.Name ?? AzureDiskEncryptionExtensionContext.LinuxExtensionDefaultName; + } + + if (this.Force.IsPresent + || this.ShouldContinue(Properties.Resources.VirtualMachineExtensionRemovalConfirmation, Properties.Resources.VirtualMachineExtensionRemovalCaption)) + { + var op = this.VirtualMachineExtensionClient.Delete(this.ResourceGroupName, this.VMName, this.Name); + WriteObject(op); + } + }); + } + } +} diff --git a/src/ResourceManager/Compute/Commands.Compute/Extension/AzureDiskEncryption/SetAzureDiskEncryptionExtension.cs b/src/ResourceManager/Compute/Commands.Compute/Extension/AzureDiskEncryption/SetAzureDiskEncryptionExtension.cs new file mode 100644 index 000000000000..efc3cbe47e28 --- /dev/null +++ b/src/ResourceManager/Compute/Commands.Compute/Extension/AzureDiskEncryption/SetAzureDiskEncryptionExtension.cs @@ -0,0 +1,438 @@ +// ---------------------------------------------------------------------------------- +// +// Copyright Microsoft Corporation +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// ---------------------------------------------------------------------------------- + +using Microsoft.Azure.Commands.Compute.Common; +using Microsoft.Azure.Commands.Compute.Models; +using Microsoft.Azure.Management.Compute; +using Microsoft.Azure.Management.Compute.Models; +using Newtonsoft.Json; +using System; +using System.Collections; +using System.Management.Automation; +using System.Globalization; +using AutoMapper; +using Microsoft.Azure.Commands.Compute.Extension.AzureVMBackup; + +namespace Microsoft.Azure.Commands.Compute.Extension.AzureDiskEncryption +{ + [Cmdlet( + VerbsCommon.Set, + ProfileNouns.AzureDiskEncryptionExtension, + DefaultParameterSetName = aadClientSecretParameterSet)] + [OutputType(typeof(PSComputeLongRunningOperation))] + public class SetAzureDiskEncryptionExtensionCommand : VirtualMachineExtensionBaseCmdlet + { + private const string aadClientCertParameterSet = "AAD Client Cert Parameters"; + private const string aadClientSecretParameterSet = "AAD Client Secret Parameters"; + private const string enableEncryptionOperation = "EnableEncryption"; + + private const string aadClientIDKey = "AADClientID"; + private const string aadClientSecretKey = "AADClientSecret"; + private const string aadClientCertThumbprintKey = "AADClientCertThumbprint"; + private const string keyVaultUrlKey = "KeyVaultURL"; + private const string keyEncryptionKeyUrlKey = "KeyEncryptionKeyURL"; + private const string keyEncryptionAlgorithmKey = "KeyEncryptionAlgorithm"; + private const string volumeTypeKey = "VolumeType"; + private const string encryptionOperationKey = "EncryptionOperation"; + private const string sequenceVersionKey = "SequenceVersion"; + private const string passphraseKey = "Passphrase"; + + [Parameter( + Mandatory = true, + Position = 0, + ValueFromPipelineByPropertyName = true, + HelpMessage = "The resource group name to which the VM belongs to")] + [ValidateNotNullOrEmpty] + public string ResourceGroupName { get; set; } + + [Alias("ResourceName")] + [Parameter( + Mandatory = true, + Position = 1, + ValueFromPipelineByPropertyName = true, + HelpMessage = "Name of the virtual machine")] + [ValidateNotNullOrEmpty] + public string VMName { get; set; } + + [Parameter( + Mandatory = true, + Position = 2, + ValueFromPipelineByPropertyName = true, + HelpMessage = "Client ID of AAD app with permissions to write secrets to KeyVault")] + public string AadClientID { get; set; } + + [Parameter( + Mandatory = true, + Position = 3, + ValueFromPipelineByPropertyName = true, + ParameterSetName = aadClientSecretParameterSet, + HelpMessage = "Client Secret of AAD app with permissions to write secrets to KeyVault")] + [ValidateNotNullOrEmpty] + public string AadClientSecret { get; set; } + + [Parameter( + Mandatory = true, + Position = 3, + ValueFromPipelineByPropertyName = true, + ParameterSetName = aadClientCertParameterSet, + HelpMessage = "Thumbprint of AAD app certificate with permissions to write secrets to KeyVault")] + [ValidateNotNullOrEmpty] + public string AadClientCertThumbprint { get; set; } + + [Parameter( + Mandatory = true, + Position = 4, + ValueFromPipelineByPropertyName = true, + HelpMessage = "URL of the KeyVault where generated encryption key will be placed to")] + public string DiskEncryptionKeyVaultUrl { get; set; } + + [Parameter( + Mandatory = true, + Position = 5, + ValueFromPipelineByPropertyName = true, + HelpMessage = "ResourceID of the KeyVault where generated encryption key will be placed to")] + public string DiskEncryptionKeyVaultId { get; set; } + + [Parameter( + Mandatory = false, + Position = 6, + ValueFromPipelineByPropertyName = true, + HelpMessage = "Versioned KeyVault URL of the KeyEncryptionKey used to encrypt the disk encryption key")] + [ValidateNotNullOrEmpty] + public string KeyEncryptionKeyUrl { get; set; } + + [Parameter( + Mandatory = false, + Position = 7, + ValueFromPipelineByPropertyName = true, + HelpMessage = "ResourceID of the KeyVault containing the KeyEncryptionKey used to encrypt the disk encryption key")] + [ValidateNotNullOrEmpty] + public string KeyEncryptionKeyVaultId { get; set; } + + [Parameter( + Mandatory = false, + Position = 8, + ValueFromPipelineByPropertyName = true, + HelpMessage = "KeyEncryption Algorithm used to encrypt the volume encryption key")] + [ValidateSet("RSA-OAEP", "RSA1_5")] + public string KeyEncryptionAlgorithm { get; set; } + + [Parameter( + Mandatory = false, + Position = 9, + ValueFromPipelineByPropertyName = true, + HelpMessage = "Type of the volume (OS or Data) to perform encryption operation")] + [ValidateSet("OS", "Data", "All")] + public string VolumeType { get; set; } + + [Parameter( + Mandatory = false, + Position = 10, + ValueFromPipelineByPropertyName = true, + HelpMessage = "Sequence version of encryption operation. This must be incremented to perform repeated encryption operations on the same VM")] + [ValidateNotNullOrEmpty] + public string SequenceVersion { get; set; } + + [Alias("HandlerVersion", "Version")] + [Parameter( + Mandatory = false, + Position = 11, + ValueFromPipelineByPropertyName = true, + HelpMessage = "The type handler version.")] + [ValidateNotNullOrEmpty] + public string TypeHandlerVersion { get; set; } + + [Alias("ExtensionName")] + [Parameter( + Mandatory = false, + Position = 12, + ValueFromPipelineByPropertyName = true, + HelpMessage = "The extension name. If this parameter is not specified, default values used are AzureDiskEncryption for windows VMs and AzureDiskEncryptionForLinux for Linux VMs")] + [ValidateNotNullOrEmpty] + public string Name { get; set; } + + [Parameter( + Mandatory = false, + Position = 13, + ValueFromPipelineByPropertyName = true, + HelpMessage = "The passphrase specified in parameters. This parameter only works for Linux VM.")] + [ValidateNotNullOrEmpty] + public string Passphrase { get; set; } + + [Parameter(HelpMessage = "To force the removal.")] + [ValidateNotNullOrEmpty] + public SwitchParameter Force { get; set; } + + private string currentOSType = null; + + private void ValidateInputParameters() + { + if (false == Uri.IsWellFormedUriString(DiskEncryptionKeyVaultId, UriKind.Absolute)) + { + ThrowTerminatingError(new ErrorRecord(new ArgumentException(string.Format(CultureInfo.CurrentUICulture, "Invalid DiskEncryptionKeyVaultUrl. Please provide a valid KeyVault URI for DiskEncryptionKeyVaultUrl")), + "InvalidArgument", + ErrorCategory.InvalidArgument, + null)); + } + if (string.IsNullOrWhiteSpace(KeyEncryptionKeyUrl) == false) + { + if (false == Uri.IsWellFormedUriString(DiskEncryptionKeyVaultId, UriKind.Absolute)) + { + ThrowTerminatingError(new ErrorRecord(new ArgumentException(string.Format(CultureInfo.CurrentUICulture, "Invalid KeyEncryptionKeyUrl. Please provide a valid KeyVault URI for KeyEncryptionKeyUrl")), + "InvalidArgument", + ErrorCategory.InvalidArgument, + null)); + } + } + } + + private string GetExtensionStatusMessage() + { + VirtualMachineExtensionGetResponse extensionResult = this.VirtualMachineExtensionClient.GetWithInstanceView(this.ResourceGroupName, this.VMName, this.Name); + if (extensionResult == null) + { + ThrowTerminatingError(new ErrorRecord(new ApplicationFailedException(string.Format(CultureInfo.CurrentUICulture, "Failed to retrieve extension status")), + "InvalidResult", + ErrorCategory.InvalidResult, + null)); + } + PSVirtualMachineExtension returnedExtension = extensionResult.ToPSVirtualMachineExtension(this.ResourceGroupName); + if ((returnedExtension == null) || + (string.IsNullOrWhiteSpace(returnedExtension.Publisher)) || + (string.IsNullOrWhiteSpace(returnedExtension.ExtensionType))) + { + ThrowTerminatingError(new ErrorRecord(new ApplicationFailedException(string.Format(CultureInfo.CurrentUICulture, "Missing extension publisher and type info")), + "InvalidResult", + ErrorCategory.InvalidResult, + null)); + } + bool publisherMatch = false; + if (string.Equals(currentOSType, "Linux", StringComparison.InvariantCultureIgnoreCase)) + { + if (returnedExtension.Publisher.Equals(AzureDiskEncryptionExtensionContext.LinuxExtensionDefaultPublisher, StringComparison.InvariantCultureIgnoreCase) && + returnedExtension.ExtensionType.Equals(AzureDiskEncryptionExtensionContext.LinuxExtensionDefaultName, StringComparison.InvariantCultureIgnoreCase)) + { + publisherMatch = true; + } + } + else if (string.Equals(currentOSType, "Windows", StringComparison.InvariantCultureIgnoreCase)) + { + if (returnedExtension.Publisher.Equals(AzureDiskEncryptionExtensionContext.ExtensionDefaultPublisher, StringComparison.InvariantCultureIgnoreCase) && + returnedExtension.ExtensionType.Equals(AzureDiskEncryptionExtensionContext.ExtensionDefaultName, StringComparison.InvariantCultureIgnoreCase)) + { + publisherMatch = true; + } + } + if (publisherMatch) + { + AzureDiskEncryptionExtensionContext context = new AzureDiskEncryptionExtensionContext(returnedExtension); + if ((context == null) || + (context.Statuses == null) || + (context.Statuses.Count < 1) || + (string.IsNullOrWhiteSpace(context.Statuses[0].Message))) + { + ThrowTerminatingError(new ErrorRecord(new ApplicationFailedException(string.Format(CultureInfo.CurrentUICulture, "Invalid extension status")), + "InvalidResult", + ErrorCategory.InvalidResult, + null)); + } + return context.Statuses[0].Message; + } + else + { + ThrowTerminatingError(new ErrorRecord(new ApplicationFailedException(string.Format(CultureInfo.CurrentUICulture, "Extension publisher and type mismatched")), + "InvalidResult", + ErrorCategory.InvalidResult, + null)); + } + return null; + } + + /// + /// This function gets the VM model, fills in the OSDisk properties with encryptionSettings and does an UpdateVM + /// + private ComputeLongRunningOperationResponse UpdateVmEncryptionSettings() + { + string statusMessage = GetExtensionStatusMessage(); + + VirtualMachine vmParameters = (this.ComputeClient.ComputeManagementClient.VirtualMachines.Get(this.ResourceGroupName, this.VMName)).VirtualMachine; + if ((vmParameters == null) || + (vmParameters.StorageProfile == null) || + (vmParameters.StorageProfile.OSDisk == null)) + { + //VM should have been created and have valid storageProfile and OSDisk by now + ThrowTerminatingError(new ErrorRecord(new ApplicationException(string.Format(CultureInfo.CurrentUICulture, "Set-AzureDiskEncryptionExtension can enable encryption only on a VM that was already created and has appropriate storageProfile and OS disk")), + "InvalidResult", + ErrorCategory.InvalidResult, + null)); + } + + DiskEncryptionSettings encryptionSettings = new DiskEncryptionSettings(); + encryptionSettings.DiskEncryptionKey = new KeyVaultSecretReference(); + encryptionSettings.DiskEncryptionKey.SourceVault = new SourceVaultReference(); + encryptionSettings.DiskEncryptionKey.SourceVault.ReferenceUri = this.DiskEncryptionKeyVaultId; + encryptionSettings.DiskEncryptionKey.SecretUrl = statusMessage; + if (this.KeyEncryptionKeyUrl != null) + { + encryptionSettings.KeyEncryptionKey = new KeyVaultKeyReference(); + encryptionSettings.KeyEncryptionKey.SourceVault = new SourceVaultReference(); + encryptionSettings.KeyEncryptionKey.SourceVault.ReferenceUri = this.KeyEncryptionKeyVaultId; + encryptionSettings.KeyEncryptionKey.KeyUrl = this.KeyEncryptionKeyUrl; + } + vmParameters.StorageProfile.OSDisk.EncryptionSettings = encryptionSettings; + var parameters = new VirtualMachine + { + DiagnosticsProfile = vmParameters.DiagnosticsProfile, + HardwareProfile = vmParameters.HardwareProfile, + StorageProfile = vmParameters.StorageProfile, + NetworkProfile = vmParameters.NetworkProfile, + OSProfile = vmParameters.OSProfile, + Plan = vmParameters.Plan, + AvailabilitySetReference = vmParameters.AvailabilitySetReference, + Location = vmParameters.Location, + Name = vmParameters.Name, + Tags = vmParameters.Tags + }; + return this.ComputeClient.ComputeManagementClient.VirtualMachines.CreateOrUpdate(this.ResourceGroupName, parameters); + } + + private string GetExtensionPublicSettings() + { + Hashtable publicSettings = new Hashtable(); + publicSettings.Add(aadClientIDKey, AadClientID ?? String.Empty); + publicSettings.Add(aadClientCertThumbprintKey, AadClientCertThumbprint ?? String.Empty); + publicSettings.Add(keyVaultUrlKey, DiskEncryptionKeyVaultUrl ?? String.Empty); + publicSettings.Add(keyEncryptionKeyUrlKey, KeyEncryptionKeyUrl ?? String.Empty); + publicSettings.Add(keyEncryptionAlgorithmKey, KeyEncryptionAlgorithm ?? String.Empty); + publicSettings.Add(volumeTypeKey, VolumeType ?? String.Empty); + publicSettings.Add(encryptionOperationKey, enableEncryptionOperation); + publicSettings.Add(sequenceVersionKey, SequenceVersion ?? String.Empty); + + return JsonConvert.SerializeObject(publicSettings); + } + + private string GetExtensionProtectedSettings() + { + Hashtable protectedSettings = new Hashtable(); + protectedSettings.Add(aadClientSecretKey, AadClientSecret ?? String.Empty); + if (string.Equals(this.currentOSType, "Linux")) + { + protectedSettings.Add(passphraseKey, Passphrase ?? null); + } + return JsonConvert.SerializeObject(protectedSettings); + } + + private VirtualMachineExtension GetVmExtensionParameters(VirtualMachine vmParameters) + { + string SettingString = GetExtensionPublicSettings(); + string ProtectedSettingString = GetExtensionProtectedSettings(); + + if (vmParameters == null) + { + ThrowTerminatingError(new ErrorRecord(new ApplicationException(string.Format(CultureInfo.CurrentUICulture, "Set-AzureDiskEncryptionExtension can enable encryption only on a VM that was already created ")), + "InvalidResult", + ErrorCategory.InvalidResult, + null)); + } + + VirtualMachineExtension vmExtensionParameters = null; + if (string.Equals(currentOSType, "Windows", StringComparison.InvariantCultureIgnoreCase)) + { + this.Name = this.Name ?? AzureDiskEncryptionExtensionContext.ExtensionDefaultName; + vmExtensionParameters = new VirtualMachineExtension + { + Location = vmParameters.Location, + Name = this.Name, + Type = VirtualMachineExtensionType, + Publisher = AzureDiskEncryptionExtensionContext.ExtensionDefaultPublisher, + ExtensionType = AzureDiskEncryptionExtensionContext.ExtensionDefaultName, + TypeHandlerVersion = (this.TypeHandlerVersion) ?? AzureDiskEncryptionExtensionContext.ExtensionDefaultVersion, + Settings = SettingString, + ProtectedSettings = ProtectedSettingString, + }; + } + else if (string.Equals(currentOSType, "Linux", StringComparison.InvariantCultureIgnoreCase)) + { + this.Name = this.Name ?? AzureDiskEncryptionExtensionContext.LinuxExtensionDefaultName; + vmExtensionParameters = new VirtualMachineExtension + { + Location = vmParameters.Location, + Name = this.Name, + Type = VirtualMachineExtensionType, + Publisher = AzureDiskEncryptionExtensionContext.LinuxExtensionDefaultPublisher, + ExtensionType = AzureDiskEncryptionExtensionContext.LinuxExtensionDefaultName, + TypeHandlerVersion = (this.TypeHandlerVersion) ?? AzureDiskEncryptionExtensionContext.LinuxExtensionDefaultVersion, + Settings = SettingString, + ProtectedSettings = ProtectedSettingString, + }; + } + + return vmExtensionParameters; + } + + private void CreateVMBackupForLinx() + { + try + { + AzureVMBackupExtensionUtil azureBackupExtensionUtil = new AzureVMBackupExtensionUtil(); + AzureVMBackupConfig vmConfig = new AzureVMBackupConfig(); + vmConfig.ResourceGroupName = ResourceGroupName; + vmConfig.VMName = VMName; + vmConfig.VirtualMachineExtensionType = VirtualMachineExtensionType; + string tag = string.Format("{0}{1}", "AzureEnc", Guid.NewGuid().ToString()); + // this would create shapshot only for Linux box. and we should wait for the snapshot found. + azureBackupExtensionUtil.CreateSnapshotForDisks(vmConfig, tag, this); + WriteWarning(string.Format("one snapshot for disks are created with tag,{0}, you can use {1}-{2} to remove it.", tag, VerbsCommon.Remove, + ProfileNouns.AzureVMBackup)); + } + catch (AzureVMBackupException e) + { + ThrowTerminatingError(new ErrorRecord(new ApplicationException(string.Format(CultureInfo.CurrentUICulture, e.ToString())), + "InvalidResult", + ErrorCategory.InvalidResult, + null)); + } + } + + protected override void ProcessRecord() + { + base.ProcessRecord(); + + ExecuteClientAction(() => + { + if (this.Force.IsPresent || + this.ShouldContinue(Properties.Resources.EnableAzureDiskEncryptionConfirmation, Properties.Resources.EnableAzureDiskEncryptionCaption)) + { + VirtualMachine virtualMachineResponse = this.ComputeClient.ComputeManagementClient.VirtualMachines.GetWithInstanceView(this.ResourceGroupName, VMName).VirtualMachine; + + currentOSType = virtualMachineResponse.StorageProfile.OSDisk.OperatingSystemType; + + if (string.Equals(currentOSType, "Linux", StringComparison.InvariantCultureIgnoreCase)) + { + CreateVMBackupForLinx(); + } + + VirtualMachineExtension parameters = GetVmExtensionParameters(virtualMachineResponse); + + this.VirtualMachineExtensionClient.CreateOrUpdate(this.ResourceGroupName, + this.VMName, + parameters); + + var op = UpdateVmEncryptionSettings(); + WriteObject(Mapper.Map(op)); + } + }); + } + } +} diff --git a/src/ResourceManager/Compute/Commands.Compute/Extension/AzureVMBackup/AzureVMBackupConfig.cs b/src/ResourceManager/Compute/Commands.Compute/Extension/AzureVMBackup/AzureVMBackupConfig.cs new file mode 100644 index 000000000000..9707b68ad110 --- /dev/null +++ b/src/ResourceManager/Compute/Commands.Compute/Extension/AzureVMBackup/AzureVMBackupConfig.cs @@ -0,0 +1,30 @@ +// ---------------------------------------------------------------------------------- +// +// Copyright Microsoft Corporation +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// ---------------------------------------------------------------------------------- + +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Microsoft.Azure.Commands.Compute.Extension.AzureVMBackup +{ + public class AzureVMBackupConfig + { + public string ResourceGroupName { get; set; } + public string VMName { get; set; } + public string ExtensionName { get; set; } + public string VirtualMachineExtensionType { get; set; } + } +} diff --git a/src/ResourceManager/Compute/Commands.Compute/Extension/AzureVMBackup/AzureVMBackupException.cs b/src/ResourceManager/Compute/Commands.Compute/Extension/AzureVMBackup/AzureVMBackupException.cs new file mode 100644 index 000000000000..681109d9f22b --- /dev/null +++ b/src/ResourceManager/Compute/Commands.Compute/Extension/AzureVMBackup/AzureVMBackupException.cs @@ -0,0 +1,38 @@ +// ---------------------------------------------------------------------------------- +// +// Copyright Microsoft Corporation +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// ---------------------------------------------------------------------------------- + +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Microsoft.Azure.Commands.Compute.Extension.AzureVMBackup +{ + public class AzureVMBackupErrorCodes + { + public const int TimeOut = 1; + public const int OSNotSupported = 2; + public const int WrongBlobUriFormat = 3; + } + + public class AzureVMBackupException : Exception + { + public AzureVMBackupException(int errorCode,string message):base(message) + { + this.AzureVMBackupErrorCode = errorCode; + } + public int AzureVMBackupErrorCode { get; set; } + } +} diff --git a/src/ResourceManager/Compute/Commands.Compute/Extension/AzureVMBackup/AzureVMBackupExtensionProtectedSettings.cs b/src/ResourceManager/Compute/Commands.Compute/Extension/AzureVMBackup/AzureVMBackupExtensionProtectedSettings.cs new file mode 100644 index 000000000000..5d3b63344df8 --- /dev/null +++ b/src/ResourceManager/Compute/Commands.Compute/Extension/AzureVMBackup/AzureVMBackupExtensionProtectedSettings.cs @@ -0,0 +1,32 @@ +// ---------------------------------------------------------------------------------- +// +// Copyright Microsoft Corporation +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// ---------------------------------------------------------------------------------- + +using System.Collections.Generic; +namespace Microsoft.Azure.Commands.Compute.Extension.AzureDiskEncryption +{ + public class AzureVMBackupBlobSasUris + { + public AzureVMBackupBlobSasUris() + { + blobSASUri = new List(); + } + public List blobSASUri { get; set; } + } + + public class AzureVMBackupExtensionProtectedSettings + { + public string logsBlobUri { get; set; } + public string objectStr { get; set; } + } +} diff --git a/src/ResourceManager/Compute/Commands.Compute/Extension/AzureVMBackup/AzureVMBackupExtensionPublicSettings.cs b/src/ResourceManager/Compute/Commands.Compute/Extension/AzureVMBackup/AzureVMBackupExtensionPublicSettings.cs new file mode 100644 index 000000000000..d3563cc844b2 --- /dev/null +++ b/src/ResourceManager/Compute/Commands.Compute/Extension/AzureVMBackup/AzureVMBackupExtensionPublicSettings.cs @@ -0,0 +1,41 @@ +// ---------------------------------------------------------------------------------- +// +// Copyright Microsoft Corporation +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// ---------------------------------------------------------------------------------- + +using System.Collections.Generic; +namespace Microsoft.Azure.Commands.Compute.Extension.AzureDiskEncryption +{ + public class AzureVMBackupMetadata + { + public AzureVMBackupMetadata() + { + backupMetadata = new List(); + } + public List backupMetadata { get; set; } + } + + public class AzureVMBackupMetadataItem + { + public string Key { get; set; } + public string Value { get; set; } + } + + public class AzureVMBackupExtensionPublicSettings + { + public string locale { get; set; } + public string taskId { get; set; } + public string commandToExecute { get; set; } + public string objectStr { get; set; } + public string commandStartTimeUTCTicks { get; set; } + } +} diff --git a/src/ResourceManager/Compute/Commands.Compute/Extension/AzureVMBackup/AzureVMBackupExtensionUtil.cs b/src/ResourceManager/Compute/Commands.Compute/Extension/AzureVMBackup/AzureVMBackupExtensionUtil.cs new file mode 100644 index 000000000000..fd99defffccf --- /dev/null +++ b/src/ResourceManager/Compute/Commands.Compute/Extension/AzureVMBackup/AzureVMBackupExtensionUtil.cs @@ -0,0 +1,274 @@ +// ---------------------------------------------------------------------------------- +// +// Copyright Microsoft Corporation +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// ---------------------------------------------------------------------------------- + + +using Microsoft.Azure.Commands.Compute.Extension.AzureDiskEncryption; +using Microsoft.Azure.Commands.Compute.Models; +using Microsoft.Azure.Commands.Compute.StorageServices; +using Microsoft.Azure.Common.Authentication; +using Microsoft.Azure.Common.Authentication.Models; +using Microsoft.Azure.Management.Compute; +using Microsoft.Azure.Management.Compute.Models; +using Microsoft.Azure.Management.Storage; +using Microsoft.WindowsAzure.Commands.Sync.Download; +using Microsoft.WindowsAzure.Storage; +using Microsoft.WindowsAzure.Storage.Auth; +using Microsoft.WindowsAzure.Storage.Blob; +using Newtonsoft.Json; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading; +using System.Threading.Tasks; + +namespace Microsoft.Azure.Commands.Compute.Extension.AzureVMBackup +{ + /// + /// Used to create/remove snapshots of the disk page blobs of the specified virtual machines. + /// + public class AzureVMBackupExtensionUtil + { + public const string extensionPublisher = "Microsoft.OSTCExtensions"; + public const string extensionType = "VMBackupForLinuxExtension"; + public const string extensionDefaultVersion = "0.1"; + public const string backupExtensionName = "vmbackupextension"; + public const string backupExtensionMetadataName = "vmbackuptag"; + public const string backupExtensionIdentityMetadataName = "vmbackupidentity"; + public const string backupSnapshotCommand = "snapshot"; + public const string backupDefaultLocale = "en-us"; + + private List GetDiskBlobUris(VirtualMachine virtualMachineResponse) + { + List blobUris = new List(); + string osDiskUri = virtualMachineResponse.StorageProfile.OSDisk.VirtualHardDisk.Uri; + blobUris.Add(osDiskUri); + var dataDisks = virtualMachineResponse.StorageProfile.DataDisks; + for (int i = 0; i < dataDisks.Count; i++) + { + blobUris.Add(dataDisks[i].VirtualHardDisk.Uri); + } + return blobUris; + } + + private string GetBase64Encoding(object obj) + { + string plainText = JsonConvert.SerializeObject(obj); + var plainTextBytes = System.Text.Encoding.UTF8.GetBytes(plainText); + string base64EncodedPrivateConfig = System.Convert.ToBase64String(plainTextBytes); + return base64EncodedPrivateConfig; + } + + /// + /// find the snapshot with the tags + /// + /// + /// + /// + /// + /// + public List FindSnapshot(List blobUris, Dictionary snapshotQuery, StorageCredentialsFactory storageCredentialsFactory) + { + List snapshots = new List(); + for (int i = 0; i < blobUris.Count; i++) + { + BlobUri blobUri = null; + if (BlobUri.TryParseUri(new Uri(blobUris[i]), out blobUri)) + { + StorageCredentials sc = storageCredentialsFactory.Create(blobUri); + CloudStorageAccount cloudStorageAccount = new CloudStorageAccount(sc, true); + CloudBlobClient blobClient = cloudStorageAccount.CreateCloudBlobClient(); + CloudBlobContainer blobContainer = blobClient.GetContainerReference(blobUri.BlobContainerName); + IEnumerable blobs = blobContainer.ListBlobs(null, true, BlobListingDetails.All); + foreach (var blob in blobs) + { + if (blob is CloudPageBlob) + { + CloudPageBlob pageBlob = blob as CloudPageBlob; + if (pageBlob.IsSnapshot && pageBlob.Name == blobUri.BlobName) + { + bool allMatch = true; + foreach (string keyToQuey in snapshotQuery.Keys) + { + if (!pageBlob.Metadata.Keys.Contains(keyToQuey)) + { + allMatch = false; + } + else if (!string.Equals(pageBlob.Metadata[keyToQuey], snapshotQuery[keyToQuey])) + { + allMatch = false; + } + } + if (allMatch) + { + snapshots.Add(pageBlob); + } + } + } + } + } + } + return snapshots; + } + + + public AzureVMBackupBlobSasUris GenerateBlobSasUris(List blobUris, CloudPageBlobObjectFactory cloudPageBlobObjectFactory) + { + AzureVMBackupBlobSasUris blobSASUris = new AzureVMBackupBlobSasUris(); + + for (int i = 0; i < blobUris.Count; i++) + { + string blobUri = blobUris[i]; + BlobUri osBlobUri = null; + if (BlobUri.TryParseUri(new Uri(blobUri), out osBlobUri)) + { + CloudPageBlob pageBlob = cloudPageBlobObjectFactory.Create(osBlobUri); + + SharedAccessBlobPolicy sasConstraints = new SharedAccessBlobPolicy(); + sasConstraints.SharedAccessExpiryTime = DateTime.UtcNow.AddMinutes(5); + sasConstraints.Permissions = SharedAccessBlobPermissions.Write | SharedAccessBlobPermissions.List; + + string sasUri = osBlobUri.Uri + pageBlob.GetSharedAccessSignature(sasConstraints); + blobSASUris.blobSASUri.Add(sasUri); + } + else + { + throw new AzureVMBackupException(AzureVMBackupErrorCodes.WrongBlobUriFormat,"the blob uri is not in correct format."); + } + } + return blobSASUris; + } + + /// + /// remove the vmbackups with the metadata key "vmbackuptag" and value snapshotTag, snapshotTag is the parameter passed in. + /// + /// + /// + /// + /// + /// + /// + /// + /// + public void RemoveSnapshot(AzureVMBackupConfig vmConfig, string snapshotTag, VirtualMachineExtensionBaseCmdlet virtualMachineExtensionBaseCmdlet) + { + VirtualMachineGetResponse virtualMachineResponse = virtualMachineExtensionBaseCmdlet.ComputeClient.ComputeManagementClient.VirtualMachines.GetWithInstanceView(vmConfig.ResourceGroupName, vmConfig.VMName); + StorageManagementClient storageClient = AzureSession.ClientFactory.CreateClient(virtualMachineExtensionBaseCmdlet.DefaultProfile.Context, AzureEnvironment.Endpoint.ResourceManager); + + StorageCredentialsFactory storageCredentialsFactory = new StorageCredentialsFactory(vmConfig.ResourceGroupName, storageClient, virtualMachineExtensionBaseCmdlet.DefaultProfile.Context.Subscription); + + List blobUris = this.GetDiskBlobUris(virtualMachineResponse.VirtualMachine); + + Dictionary snapshotQuery = new Dictionary(); + List snapshots = this.FindSnapshot(blobUris, snapshotQuery, storageCredentialsFactory); + foreach (CloudPageBlob snapshot in snapshots) + { + snapshot.Delete(); + } + } + + + /// + /// we only support the Linux box now, if it's a windows, one AzureVMBackupException would be thrown. + /// + /// + /// + /// + /// + /// + /// + /// + public void CreateSnapshotForDisks(AzureVMBackupConfig vmConfig, string snapshotTag, VirtualMachineExtensionBaseCmdlet virtualMachineExtensionBaseCmdlet) + { + VirtualMachine virtualMachine = virtualMachineExtensionBaseCmdlet.ComputeClient.ComputeManagementClient.VirtualMachines.GetWithInstanceView(vmConfig.ResourceGroupName, vmConfig.VMName).VirtualMachine; + StorageManagementClient storageClient = AzureSession.ClientFactory.CreateClient(virtualMachineExtensionBaseCmdlet.DefaultProfile.Context, AzureEnvironment.Endpoint.ResourceManager); + + StorageCredentialsFactory storageCredentialsFactory = new StorageCredentialsFactory(vmConfig.ResourceGroupName, storageClient, virtualMachineExtensionBaseCmdlet.DefaultProfile.Context.Subscription); + + CloudPageBlobObjectFactory cloudPageBlobObjectFactory = new CloudPageBlobObjectFactory(storageCredentialsFactory, TimeSpan.FromMinutes(1)); + + List vmPageBlobUris = this.GetDiskBlobUris(virtualMachine); + + AzureVMBackupBlobSasUris blobSASUris = this.GenerateBlobSasUris(vmPageBlobUris, cloudPageBlobObjectFactory); + + string taskId = Guid.NewGuid().ToString(); + + AzureVMBackupExtensionProtectedSettings privateConfig = new AzureVMBackupExtensionProtectedSettings(); + privateConfig.logsBlobUri = string.Empty; + privateConfig.objectStr = this.GetBase64Encoding(blobSASUris); + + AzureVMBackupExtensionPublicSettings publicConfig = new AzureVMBackupExtensionPublicSettings(); + publicConfig.commandToExecute = backupSnapshotCommand; + publicConfig.locale = backupDefaultLocale; + publicConfig.commandStartTimeUTCTicks = DateTimeOffset.UtcNow.Ticks.ToString(); + publicConfig.taskId = taskId; + AzureVMBackupMetadata backupMetadata = new AzureVMBackupMetadata(); + + AzureVMBackupMetadataItem tagMetadataItem = new AzureVMBackupMetadataItem(); + tagMetadataItem.Key = backupExtensionMetadataName; + tagMetadataItem.Value = snapshotTag; + + AzureVMBackupMetadataItem taskIdMetadataItem = new AzureVMBackupMetadataItem(); + taskIdMetadataItem.Key = backupExtensionIdentityMetadataName; + taskIdMetadataItem.Value = taskId; + + backupMetadata.backupMetadata.Add(tagMetadataItem); + backupMetadata.backupMetadata.Add(taskIdMetadataItem); + + publicConfig.objectStr = this.GetBase64Encoding(backupMetadata); + + string publicSettingString = JsonConvert.SerializeObject(publicConfig); + + string ProtectedSettingString = JsonConvert.SerializeObject(privateConfig); + VirtualMachineExtension vmExtensionParameters = new VirtualMachineExtension + { + Location = virtualMachine.Location, + Name = vmConfig.ExtensionName ?? backupExtensionName, + Type = vmConfig.VirtualMachineExtensionType, + Publisher = extensionPublisher, + ExtensionType = extensionType, + TypeHandlerVersion = extensionDefaultVersion, + Settings = publicSettingString, + ProtectedSettings = ProtectedSettingString, + }; + + ComputeLongRunningOperationResponse vmBackupOperation = virtualMachineExtensionBaseCmdlet.VirtualMachineExtensionClient.CreateOrUpdate(vmConfig.ResourceGroupName, vmConfig.VMName, vmExtensionParameters); + + // check the snapshots with the task id are all created. + int timePeriod = 5000; + int loopingTimes = ((int)TimeSpan.FromMinutes(10).TotalMilliseconds / timePeriod); + + Dictionary snapshotQuery = new Dictionary(); + snapshotQuery.Add(backupExtensionMetadataName, snapshotTag); + snapshotQuery.Add(backupExtensionIdentityMetadataName, taskId); + int i = 0; + for (; i < loopingTimes; i++) + { + List snapshotsFound = this.FindSnapshot(vmPageBlobUris, snapshotQuery, storageCredentialsFactory); + if (snapshotsFound.Count == vmPageBlobUris.Count) + { + break; + } + else + { + Thread.Sleep(timePeriod); + } + } + if (i == loopingTimes) + { + throw new AzureVMBackupException(AzureVMBackupErrorCodes.TimeOut, "snapshot not created, or not found in time."); + } + } + } +} diff --git a/src/ResourceManager/Compute/Commands.Compute/Extension/AzureVMBackup/RemoveAzureVMBackup.cs b/src/ResourceManager/Compute/Commands.Compute/Extension/AzureVMBackup/RemoveAzureVMBackup.cs new file mode 100644 index 000000000000..b76a8fc4f8c9 --- /dev/null +++ b/src/ResourceManager/Compute/Commands.Compute/Extension/AzureVMBackup/RemoveAzureVMBackup.cs @@ -0,0 +1,96 @@ +// ---------------------------------------------------------------------------------- +// +// Copyright Microsoft Corporation +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// ---------------------------------------------------------------------------------- + + +using Microsoft.Azure.Commands.Compute.Common; +using Microsoft.Azure.Commands.Compute.Extension.AzureDiskEncryption; +using Microsoft.Azure.Commands.Compute.Extension.AzureVMBackup; +using Microsoft.Azure.Commands.Compute.Models; +using Microsoft.Azure.Commands.Compute.StorageServices; +using Microsoft.Azure.Common.Authentication; +using Microsoft.Azure.Common.Authentication.Models; +using Microsoft.Azure.Management.Compute; +using Microsoft.Azure.Management.Compute.Models; +using Microsoft.Azure.Management.Storage; +using Microsoft.WindowsAzure.Commands.Sync.Download; +using Microsoft.WindowsAzure.Storage; +using Microsoft.WindowsAzure.Storage.Auth; +using Microsoft.WindowsAzure.Storage.Blob; +using System; +using System.Collections; +using System.Collections.Generic; +using System.Globalization; +using System.Linq; +using System.Management.Automation; +using System.Text; +using System.Threading.Tasks; + +namespace Microsoft.Azure.Commands.Compute.Extension.AzureVMBackup +{ + [Cmdlet( + VerbsCommon.Remove, + ProfileNouns.AzureVMBackup)] + [OutputType(typeof(PSComputeLongRunningOperation))] + public class RemoveAzureVMBackup : VirtualMachineExtensionBaseCmdlet + { + [Parameter( + Mandatory = true, + Position = 0, + ValueFromPipelineByPropertyName = true, + HelpMessage = "The resource group name.")] + [ValidateNotNullOrEmpty] + public string ResourceGroupName { get; set; } + + [Alias("ResourceName")] + [Parameter( + Mandatory = true, + Position = 1, + ValueFromPipelineByPropertyName = true, + HelpMessage = "The virtual machine name.")] + [ValidateNotNullOrEmpty] + public string VMName { get; set; } + + [Parameter( + Mandatory = true, + Position = 2, + ValueFromPipelineByPropertyName = true, + HelpMessage = "The tag for this backup.")] + public string Tag { get; set; } + + protected override void ProcessRecord() + { + base.ProcessRecord(); + + VirtualMachineGetResponse virtualMachineResponse = this.ComputeClient.ComputeManagementClient.VirtualMachines.GetWithInstanceView(this.ResourceGroupName, VMName); + string currentOSType = virtualMachineResponse.VirtualMachine.StorageProfile.OSDisk.OperatingSystemType; + + if (string.Equals(currentOSType, "Linux", StringComparison.InvariantCultureIgnoreCase)) + { + AzureVMBackupExtensionUtil util = new AzureVMBackupExtensionUtil(); + AzureVMBackupConfig vmConfig = new AzureVMBackupConfig(); + vmConfig.ResourceGroupName = ResourceGroupName; + vmConfig.VMName = VMName; + vmConfig.VirtualMachineExtensionType = VirtualMachineExtensionType; + util.RemoveSnapshot(vmConfig, Tag, this); + } + else + { + ThrowTerminatingError(new ErrorRecord(new ArgumentException(string.Format(CultureInfo.CurrentUICulture, "The VM should be a Linux VM")), + "InvalidArgument", + ErrorCategory.InvalidArgument, + null)); + } + } + } +} diff --git a/src/ResourceManager/Compute/Commands.Compute/Extension/AzureVMBackup/SetAzureVMBackupExtension.cs b/src/ResourceManager/Compute/Commands.Compute/Extension/AzureVMBackup/SetAzureVMBackupExtension.cs new file mode 100644 index 000000000000..61378dd55868 --- /dev/null +++ b/src/ResourceManager/Compute/Commands.Compute/Extension/AzureVMBackup/SetAzureVMBackupExtension.cs @@ -0,0 +1,93 @@ +// ---------------------------------------------------------------------------------- +// +// Copyright Microsoft Corporation +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// ---------------------------------------------------------------------------------- + + +using Microsoft.Azure.Commands.Compute.Common; +using Microsoft.Azure.Commands.Compute.Extension.AzureVMBackup; +using Microsoft.Azure.Commands.Compute.Models; +using Microsoft.Azure.Commands.Compute.StorageServices; +using Microsoft.Azure.Common.Authentication; +using Microsoft.Azure.Common.Authentication.Models; +using Microsoft.Azure.Management.Compute; +using Microsoft.Azure.Management.Compute.Models; +using Microsoft.Azure.Management.Storage; +using Microsoft.WindowsAzure.Commands.Sync.Download; +using Microsoft.WindowsAzure.Storage.Blob; +using Newtonsoft.Json; +using System; +using System.Collections; +using System.Collections.Generic; +using System.Globalization; +using System.Linq; +using System.Management.Automation; +using System.Text; +using System.Threading.Tasks; + +namespace Microsoft.Azure.Commands.Compute.Extension.AzureDiskEncryption +{ + [Cmdlet( + VerbsCommon.Set, + ProfileNouns.AzureVMBackupExtension)] + [OutputType(typeof(PSComputeLongRunningOperation))] + public class SetAzureVMBackupExtension: VirtualMachineExtensionBaseCmdlet + { + [Parameter( + Mandatory = true, + Position = 0, + ValueFromPipelineByPropertyName = true, + HelpMessage = "The resource group name.")] + [ValidateNotNullOrEmpty] + public string ResourceGroupName { get; set; } + + [Alias("ResourceName")] + [Parameter( + Mandatory = true, + Position = 1, + ValueFromPipelineByPropertyName = true, + HelpMessage = "The virtual machine name.")] + [ValidateNotNullOrEmpty] + public string VMName { get; set; } + + [Alias("ExtensionName")] + [Parameter( + Mandatory = true, + Position = 2, + ValueFromPipelineByPropertyName = true, + HelpMessage = "The extension name.")] + [ValidateNotNullOrEmpty] + public string Name { get; set; } + + [Parameter( + Mandatory = true, + Position = 2, + ValueFromPipelineByPropertyName = true, + HelpMessage = "The tag for this backup.")] + public string Tag { get; set; } + + protected override void ProcessRecord() + { + base.ProcessRecord(); + + AzureVMBackupExtensionUtil azureBackupExtensionUtil = new AzureVMBackupExtensionUtil(); + + AzureVMBackupConfig vmConfig = new AzureVMBackupConfig(); + vmConfig.ResourceGroupName = ResourceGroupName; + vmConfig.VMName = VMName; + vmConfig.ExtensionName = Name; + vmConfig.VirtualMachineExtensionType = VirtualMachineExtensionType; + + azureBackupExtensionUtil.CreateSnapshotForDisks(vmConfig,Tag, this); + } + } +} diff --git a/src/ResourceManager/Compute/Commands.Compute/Microsoft.Azure.Commands.Compute.dll-Help.xml b/src/ResourceManager/Compute/Commands.Compute/Microsoft.Azure.Commands.Compute.dll-Help.xml index 977eeded5b29..4041736ad4d8 100644 --- a/src/ResourceManager/Compute/Commands.Compute/Microsoft.Azure.Commands.Compute.dll-Help.xml +++ b/src/ResourceManager/Compute/Commands.Compute/Microsoft.Azure.Commands.Compute.dll-Help.xml @@ -1,4853 +1,6263 @@ - - - - - - Add-AzureRmVMAdditionalUnattendContent - - Adds information to the unattended Windows Setup answer file. - - - - - Add - AzureVMAdditionalUnattendContent - - - - The Add-AzureRmVMAdditionalUnattendContent cmdlet adds information to the unattended Windows Setup answer file. Specify additional base 64 encoded XML formatted information that this cmdlet adds to the unattend.xml file. - - - - Add-AzureRmVMAdditionalUnattendContent - - VM - - Specifies the virtual machine object that this cmdlet modifies. To obtain a virtual machine object, use the Get-AzureRmVM cmdlet. Create a virtual machine object by using the New-AzureRmVMConfig cmdlet. - - PSVirtualMachine - - - Content - - Specifies base 64 encoded XML formatted content. This cmdlet adds the content to the unattend.xml file. The XML content must be less than 4 KB and must include the root element for the setting or feature that this cmdlet inserts. - - String - - - SettingName - - Specifies the name of the setting to which the content applies. Valid values are: - --- FirstLogonCommands + + + + + Add-AzureRmVhd + + + + + + + Add + AzureRmVhd + + + + + + + + Add-AzureRmVhd + + ResourceGroupName + + + + String + + + Destination + + + + Uri + + + LocalFilePath + + + + FileInfo + + + NumberOfUploaderThreads + + + + Nullable`1[Int32] + + + BaseImageUriToPatch + + + + Uri + + + OverWrite + + + + SwitchParameter + + + InformationAction + + + + ActionPreference + + + InformationVariable + + + + String + + + + + + ResourceGroupName + + + + String + + String + + + + + + Destination + + + + Uri + + Uri + + + + + + LocalFilePath + + + + FileInfo + + FileInfo + + + + + + NumberOfUploaderThreads + + + + Nullable`1[Int32] + + Nullable`1[Int32] + + + + + + BaseImageUriToPatch + + + + Uri + + Uri + + + + + + OverWrite + + + + SwitchParameter + + SwitchParameter + + + + + + InformationAction + + + + ActionPreference + + ActionPreference + + + + + + InformationVariable + + + + String + + String + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Add-AzureRmVMAdditionalUnattendContent + + Adds information to the unattended Windows Setup answer file. + + + + + Add + AzureRmVMAdditionalUnattendContent + + + + The Add-AzureRmVMAdditionalUnattendContent cmdlet adds information to the unattended Windows Setup answer file. Specify additional base 64 encoded XML formatted information that this cmdlet adds to the unattend.xml file. + + + + Add-AzureRmVMAdditionalUnattendContent + + VM + + Specifies the virtual machine object that this cmdlet modifies. To obtain a virtual machine object, use the Get-AzureRmVM cmdlet. Create a virtual machine object by using the New-AzureRmVMConfig cmdlet. + + PSVirtualMachine + + + Content + + Specifies base 64 encoded XML formatted content. This cmdlet adds the content to the unattend.xml file. The XML content must be less than 4 KB and must include the root element for the setting or feature that this cmdlet inserts. + + String + + + SettingName + + Specifies the name of the setting to which the content applies. Valid values are: + -- FirstLogonCommands -- AutoLogon - - String - - - Profile - - Specifies the Azure profile from which this cmdlet reads. If you do not specify a profile, this cmdlet reads from the local default profile. - - AzureProfile - - - - - - Content - - Specifies base 64 encoded XML formatted content. This cmdlet adds the content to the unattend.xml file. The XML content must be less than 4 KB and must include the root element for the setting or feature that this cmdlet inserts. - - String - - String - - - none - - - Profile - - Specifies the Azure profile from which this cmdlet reads. If you do not specify a profile, this cmdlet reads from the local default profile. - - AzureProfile - - AzureProfile - - - none - - - SettingName - - Specifies the name of the setting to which the content applies. Valid values are: - --- FirstLogonCommands + + String + + + InformationAction + + + + ActionPreference + + + InformationVariable + + + + String + + + + + + VM + + Specifies the virtual machine object that this cmdlet modifies. To obtain a virtual machine object, use the Get-AzureRmVM cmdlet. Create a virtual machine object by using the New-AzureRmVMConfig cmdlet. + + PSVirtualMachine + + PSVirtualMachine + + + none + + + Content + + Specifies base 64 encoded XML formatted content. This cmdlet adds the content to the unattend.xml file. The XML content must be less than 4 KB and must include the root element for the setting or feature that this cmdlet inserts. + + String + + String + + + none + + + SettingName + + Specifies the name of the setting to which the content applies. Valid values are: + -- FirstLogonCommands -- AutoLogon - - String - - String - - - none - - - VM - - Specifies the virtual machine object that this cmdlet modifies. To obtain a virtual machine object, use the Get-AzureRmVM cmdlet. Create a virtual machine object by using the New-AzureRmVMConfig cmdlet. - - PSVirtualMachine - - PSVirtualMachine - - - none - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Example 1: Add content to unattend.xml - - - - - PS C:\>$AvailabilitySet = Get-AzureRmAvailabilitySet -ResourceGroupName "ResourceGroup11" -Name "AvailabilitySet03" -PS C:\> $VirtualMachine = New-AzureRmVMConfig -VMName "VirtualMachine07" -VMSize "Standard_A1" -AvailabilitySetID $AvailabilitySet.Id + + String + + String + + + none + + + InformationAction + + + + ActionPreference + + ActionPreference + + + + + + InformationVariable + + + + String + + String + + + + + + Profile + + Specifies the Azure profile from which this cmdlet reads. If you do not specify a profile, this cmdlet reads from the local default profile. + + azureprofile + + azureprofile + + + none + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Keywords: azure, azurerm, arm, resource, management, manager, compute, vm, iaas + + + + + -------------------------- Example 1: Add content to unattend.xml -------------------------- + + PS C:\> + + PS C:\>$AvailabilitySet = Get-AzureRmAvailabilitySet -ResourceGroupName "ResourceGroup11" -Name "AvailabilitySet03" +PS C:\> $VirtualMachine = New-AzureRmVMConfig -VMName "VirtualMachine07" -VMSize "Standard_A1" -AvailabilitySetID $AvailabilitySet.Id PS C:\> $Credential = Get-Credential -PS C:\> $VirtualMachine = Set-AzureRmVMOperatingSystem -VM $VirtualMachine -Windows -ComputerName "Contoso26" -Credential $Credential -PS C:\> $AucContent = "<UserAccounts><AdministratorPassword><Value>" + "Password" + "</Value><PlainText>true</PlainText></AdministratorPassword></UserAccounts>"; -PS C:\> $VirtualMachine = Add-AzureRmVMAdditionalUnattendContent -VM $VirtualMachine -Content $AucContent -SettingName "AutoLogon" - - - The first command gets the availability set named AvailablitySet03 in the resource group named ResourceGroup11, and then stores that object in the $AvailabilitySet variable. - The second command creates a virtual machine object, and then stores it in the $VirtualMachine variable. The command assigns a name and size to the virtual machine. The virtual machine belongs to the availability set stored in $AvailabilitySet. - The third command creates a credential object by using the Get-Credential cmdlet, and then stores the result in the $Credential variable. The command prompts you for a user name and password. For more information, type Get-Help Get-Credential. - The fourth command uses the Set-AzureRmVMOperatingSystem cmdlet to configure the virtual machine stored in $VirtualMachine. - The fifth command assigns content to the $AucContent variable. The content includes a password. - The final command adds the content stored in $AucContent to the unattend.xml file. - - - - - - - - - - - - - Get-AzureRmAvailabilitySet - - - - Set-AzureRmVMOperatingSystem - - - - New-AzureRmVMConfig - - - - - - Keywords: azure, azurerm, arm, resource, management, manager, compute, vm, iaas - - - - - - Add-AzureRmVMDataDisk - - Adds a data disk to a virtual machine. - - - - - Add - AzureVMDataDisk - - - - The Add-AzureRmVMDataDisk cmdlet adds a data disk to a virtual machine. You can add a data disk when you create a virtual machine, or you can add a data disk to an existing virtual machine. - - - - Add-AzureRmVMDataDisk - - VM - - Specifies the local virtual machine object to which to add a data disk. To obtain a virtual machine object, use the Get-AzureRmVM cmdlet. Create a virtual machine object by using the New-AzureRmVMConfig cmdlet. - - PSVirtualMachine - - - Name - - Specifies the name of the data disk to add. - - String - - - VhdUri - - Specifies the Uniform Resource Identifier (URI) for the virtual hard disk (VHD) file to create when a platform image or user image is used. This cmdlet copies the image binary large object (BLOB) to this location. This is the location from which to start the virtual machine. - - String - - - Caching - - Specifies the caching mode of the disk. Valid values are: - --- ReadOnly --- ReadWrite - -The default value is ReadWrite. Changing this value causes the virtual machine to restart. - This setting affects the consistency and performance of the disk. - - - ReadOnly - ReadWrite - - - - DiskSizeInGB - - Specifies the size, in gigabytes, of an empty disk to attach to a virtual machine. - - Int32] - - - Lun - - Specifies the logical unit number (LUN) for a data disk. - - Int32] - - - CreateOption - - Specifies whether this cmldet creates a disk in the virtual machine from a platform or user image, creates an empty disk, or attaches an existing disk. Valid values are: - --- Attach +PS C:\> $VirtualMachine = Set-AzureRmVMOperatingSystem -VM $VirtualMachine -Windows -ComputerName "Contoso26" -Credential $Credential +PS C:\> $AucContent = "<UserAccounts><AdministratorPassword><Value>" + "Password" + "</Value><PlainText>true</PlainText></AdministratorPassword></UserAccounts>"; +PS C:\> $VirtualMachine = Add-AzureRmVMAdditionalUnattendContent -VM $VirtualMachine -Content $AucContent -SettingName "AutoLogon" + + The first command gets the availability set named AvailablitySet03 in the resource group named ResourceGroup11, and then stores that object in the $AvailabilitySet variable. + + + The fourth command uses the Set-AzureRmVMOperatingSystem cmdlet to configure the virtual machine stored in $VirtualMachine. + + + + + + + + + + + + + Get-AzureRmAvailabilitySet + + + + Set-AzureRmVMOperatingSystem + + + + New-AzureRmVMConfig + + + + + + + + Add-AzureRmVMDataDisk + + Adds a data disk to a virtual machine. + + + + + Add + AzureRmVMDataDisk + + + + The Add-AzureRmVMDataDisk cmdlet adds a data disk to a virtual machine. You can add a data disk when you create a virtual machine, or you can add a data disk to an existing virtual machine. + + + + Add-AzureRmVMDataDisk + + VM + + Specifies the local virtual machine object to which to add a data disk. To obtain a virtual machine object, use the Get-AzureRmVM cmdlet. Create a virtual machine object by using the New-AzureRmVMConfig cmdlet. + + PSVirtualMachine + + + Name + + Specifies the name of the data disk to add. + + String + + + VhdUri + + Specifies the Uniform Resource Identifier (URI) for the virtual hard disk (VHD) file to create when a platform image or user image is used. This cmdlet copies the image binary large object (BLOB) to this location. This is the location from which to start the virtual machine. + + String + + + Caching + + Specifies the caching mode of the disk. Valid values are: + -- ReadOnly +-- ReadWrite + The default value is ReadWrite. Changing this value causes the virtual machine to restart. + This setting affects the consistency and performance of the disk. + + String + + + DiskSizeInGB + + Specifies the size, in gigabytes, of an empty disk to attach to a virtual machine. + + Nullable`1[Int32] + + + Lun + + Specifies the logical unit number (LUN) for a data disk. + + Nullable`1[Int32] + + + CreateOption + + Specifies whether this cmldet creates a disk in the virtual machine from a platform or user image, creates an empty disk, or attaches an existing disk. Valid values are: + -- Attach -- Empty -- FromImage - - - empty - attach - fromImage - - - - SourceImageUri - - Specifies the source URI of the disk that this cmdlet attaches. - - System.String - - - Profile - - Specifies the Azure profile from which this cmdlet reads. If you do not specify a profile, this cmdlet reads from the local default profile. - - AzureProfile - - - - - - Caching - - Specifies the caching mode of the disk. Valid values are: - --- ReadOnly --- ReadWrite - -The default value is ReadWrite. Changing this value causes the virtual machine to restart. - This setting affects the consistency and performance of the disk. - - String - - String - - - none - - - CreateOption - - Specifies whether this cmldet creates a disk in the virtual machine from a platform or user image, creates an empty disk, or attaches an existing disk. Valid values are: - --- Attach + + String + + + SourceImageUri + + Specifies the source URI of the disk that this cmdlet attaches. + + String + + + InformationAction + + + + ActionPreference + + + InformationVariable + + + + String + + + + + + VM + + Specifies the local virtual machine object to which to add a data disk. To obtain a virtual machine object, use the Get-AzureRmVM cmdlet. Create a virtual machine object by using the New-AzureRmVMConfig cmdlet. + + PSVirtualMachine + + PSVirtualMachine + + + none + + + Name + + Specifies the name of the data disk to add. + + String + + String + + + none + + + VhdUri + + Specifies the Uniform Resource Identifier (URI) for the virtual hard disk (VHD) file to create when a platform image or user image is used. This cmdlet copies the image binary large object (BLOB) to this location. This is the location from which to start the virtual machine. + + String + + String + + + none + + + Caching + + Specifies the caching mode of the disk. Valid values are: + -- ReadOnly +-- ReadWrite + The default value is ReadWrite. Changing this value causes the virtual machine to restart. + This setting affects the consistency and performance of the disk. + + String + + String + + + none + + + DiskSizeInGB + + Specifies the size, in gigabytes, of an empty disk to attach to a virtual machine. + + Nullable`1[Int32] + + Nullable`1[Int32] + + + none + + + Lun + + Specifies the logical unit number (LUN) for a data disk. + + Nullable`1[Int32] + + Nullable`1[Int32] + + + none + + + CreateOption + + Specifies whether this cmldet creates a disk in the virtual machine from a platform or user image, creates an empty disk, or attaches an existing disk. Valid values are: + -- Attach -- Empty -- FromImage - - System.String - - System.String - - - none - - - DiskSizeInGB - - Specifies the size, in gigabytes, of an empty disk to attach to a virtual machine. - - Int32] - - Int32] - - - none - - - Lun - - Specifies the logical unit number (LUN) for a data disk. - - Int32] - - Int32] - - - none - - - Name - - Specifies the name of the data disk to add. - - String - - String - - - none - - - Profile - - Specifies the Azure profile from which this cmdlet reads. If you do not specify a profile, this cmdlet reads from the local default profile. - - AzureProfile - - AzureProfile - - - none - - - SourceImageUri - - Specifies the source URI of the disk that this cmdlet attaches. - - System.String - - System.String - - - none - - - VhdUri - - Specifies the Uniform Resource Identifier (URI) for the virtual hard disk (VHD) file to create when a platform image or user image is used. This cmdlet copies the image binary large object (BLOB) to this location. This is the location from which to start the virtual machine. - - String - - String - - - none - - - VM - - Specifies the local virtual machine object to which to add a data disk. To obtain a virtual machine object, use the Get-AzureRmVM cmdlet. Create a virtual machine object by using the New-AzureRmVMConfig cmdlet. - - PSVirtualMachine - - PSVirtualMachine - - - none - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Example 1: Add data disks to a new virtual machine - - - - - PS C:\>$VirtualMachine = New-AzureRmVMConfig -VMName "VirtualMachine07" -VMSize "Standard_A1" -PS C:\> $DataDiskVhdUri01 = "https://contoso.blob.core.windows.net/test/data1.vhd" -PS C:\> $DataDiskVhdUri02 = "https://contoso.blob.core.windows.net/test/data2.vhd" -PS C:\> $DataDiskVhdUri03 = "https://contoso.blob.core.windows.net/test/data3.vhd" -PS C:\> $VirtualMachine = Add-AzureRmVMDataDisk -VM $VirtualMachine -Name 'DataDisk1' -Caching 'ReadOnly' -DiskSizeInGB 10 -Lun 0 -VhdUri $DataDiskVhdUri1 -CreateOption Empty -PS C:\> $VirtualMachine = Add-AzureRmVMDataDisk -VM $VirtualMachine -Name 'DataDisk2' -Caching 'ReadOnly' -DiskSizeInGB 11 -Lun 1 -VhdUri $DataDiskVhdUri2 -CreateOption Empty -PS C:\> $VirtualMachine = Add-AzureRmVMDataDisk -VM $VirtualMachine -Name 'DataDisk3' -Caching 'ReadOnly' -DiskSizeInGB 12 -Lun 2 -VhdUri $DataDiskVhdUri3 -CreateOption Empty - - - - The first command creates a virtual machine object, and then stores it in the $VirtualMachine variable. The command assigns a name and size to the virtual machine. - The next three commands assign paths of three data disks to the $DataDiskVhdUri01, $DataDiskVhdUri02, and $DataDiskVhdUri03 variables. This approach is only for readability of the following commands. - The final three commands each adds a data disk to the virtual machine stored in $VirtualMachine. The command specifies the name and location for the disk, and other properties of the disk. The URI of each disk is stored in $DataDiskVhdUri01, $DataDiskVhdUri02, and $DataDiskVhdUri03. - - - - - - - - - - - Example 2: Add a data disk to an existing virtual machine - - - - - PS C:\>$VirtualMachine = Get-AzureRmVM -ResourceGroupName "ResourceGroup11" -Name "VirtualMachine07" -PS C:\> Add-AzureRmVMDataDisk -VM $VirtualMachine -Name "disk1" -VhdUri "https://contoso.blob.core.windows.net/vhds/diskstandard03.vhd" -LUN 0 -Caching ReadOnly -DiskSizeinGB 1 -CreateOption Empty -PS C:\> Update-AzureRmVM -ResourceGroupName "ResourceGroup11" -Name "VirtualMachine07" -VM $VirtualMachine - - - - The first command gets the virtual machine named VirtualMachine07 by using the Get-AzureRmVM cmdlet. The command stores the virtual machine in the $VirtualMachine variable. - The second command adds a data disk to the virtual machine stored in $VirtualMachine. - The final command updates the state of the virtual machine stored in $VirtualMachine in ResourceGroup11. - - - - - - - - - - - - - Remove-AzureRmVMDataDisk - - - - Get-AzureRmVM - - - - New-AzureRmVMConfig - - - - - - Keywords: azure, azurerm, arm, resource, management, manager, compute, vm, iaas - - - - - - Add-AzureRmVMNetworkInterface - - Adds a network interface to a virtual machine. - - - - - Add - AzureVMNetworkInterface - - - - The Add-AzureRmVMNetworkInterface cmdlet adds a network interface to a virtual machine. You can add an interface when you create a virtual machine or add one to an existing virtual machine. - - - - Add-AzureRmVMNetworkInterface - - VM - - Specifies a local virtual machine object to which to add a network interface. To create a virtual machine, use the New-AzureRmVMConfig cmdlet. To obtain an existing virtual machine, use the Get-AzureRmVM cmdlet. - - PSVirtualMachine - - - Id - - Specifies the ID of a network interface to add to a virtual machine. To obtain a network interface, use the Get-AzureRmNetworkInterface cmdlet. - - String - - - Primary - - Indicates that this cmdlet adds the network interface as the primary interface. - - - - Profile - - Specifies the Azure profile from which this cmdlet reads. If you do not specify a profile, this cmdlet reads from the local default profile. - - AzureProfile - - - - - - Id - - Specifies the ID of a network interface to add to a virtual machine. To obtain a network interface, use the Get-AzureRmNetworkInterface cmdlet. - - String - - String - - - none - - - Primary - - Indicates that this cmdlet adds the network interface as the primary interface. - - SwitchParameter - - SwitchParameter - - - none - - - Profile - - Specifies the Azure profile from which this cmdlet reads. If you do not specify a profile, this cmdlet reads from the local default profile. - - AzureProfile - - AzureProfile - - - none - - - VM - - Specifies a local virtual machine object to which to add a network interface. To create a virtual machine, use the New-AzureRmVMConfig cmdlet. To obtain an existing virtual machine, use the Get-AzureRmVM cmdlet. - - PSVirtualMachine - - PSVirtualMachine - - - none - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Example 1: Add a network interface to a new virtual machine - - - - - PS C:\>$VirtualMachine = New-AzureRmVMConfig -VMName "VirtualMachine07" -VMSize "Standard_A1" -PS C:\> Add-AzureRmVMNetworkInterface -VM $VirtualMachine -Id "/subscriptions/46fc8ea4-2de6-4179-8ab1-365da4121af4/resourceGroups/contoso/providers/Microsoft.Network/networkInterfaces/sshNIC" - - - The first command creates a virtual machine object, and then stores it in the $VirtualMachine variable. The command assigns a name and size to the virtual machine. - The second command adds a network interface to the virtual machine stored in $VirtualMachine. - - - - - - - - - - - Example 2: Add a network interface to an existing virtual machine - - - - - PS C:\>$VirtualMachine = Get-AzureRmVM -ResourceGroupName "ResourceGroup11" -Name "VirtualMachine07" -PS C:\> Add-AzureRmVMNetworkInterface -VM $VirtualMachine -Id "/subscriptions/46fc8ea4-2de6-4179-8ab1-365da4121af4/resourceGroups/contoso/providers/Microsoft.Network/networkInterfaces/sshNIC" -PS C:\> Update-AzureRmVM -ResourceGroupName "ResourceGroup11" -Name " VirtualMachine07" -VM $VirtualMachine - - - The first command gets the virtual machine named VirtualMachine07 by using the Get-AzureRmVM cmldet. The command stores the virtual machine in the $VirtualMachine variable. - The second command adds a network interface to the virtual machine stored in $VirtualMachine. - The final command updates the state of the virtual machine stored in $VirtualMachine in ResourceGroup11. - - - - - - - - - - - - - New-AzureRmVMConfig - - - - Get-AzureRmVM - - - - Get-AzureRmAvailabilitySet - - - - - - Keywords: azure, azurerm, arm, resource, management, manager, compute, vm, iaas - - - - - - Add-AzureRmVMSecret - - Adds a secret to a virtual machine. - - - - - Add - AzureVMSecret - - - - The Add-AzureRmVMSecret cmdlet adds a secret to a virtual machine. This value lets you add a certificate to the virtual machine. The secret needs to be stored in a Key Vault. For more information about Key Vault, see What is Azure Key Vault? (https://azure.microsoft.com/en-us/documentation/articles/key-vault-whatis/) in the Azure library. For more information about the cmdlets, see Azure Key Vault Cmdlets (https://msdn.microsoft.com/library/azure/dn868052.aspx) in the Microsoft Developer Network library or type Get-Help Set-AzureKeyVaultSecret. - - - - Add-AzureRmVMSecret - - VM - - Specifies the virtual machine object that this cmdlet modifies. To obtain a virtual machine object, use the Get-AzureRmVM cmdlet. Create a virtual machine object by using the New-AzureRmVMConfig cmdlet. - - PSVirtualMachine - - - SourceVaultId - - Specifies the resource ID of the Key Vault that contains the certificates that you can add to the virtual machine. This value also acts as the key for adding multiple certificates. This means that you can use the same value for SourceVaultId when you add multiple certificates from the same Key Vault. - - String - - - CertificateStore - - Specifies the name of a certificate store on the virtual machine that runs the Windows operating system. This cmdlet adds the certificate to the store that this parameter specifies. You can only specify this parameter for virtual machines that run the Windows operating system. - - String - - - CertificateUrl - - Specifies the URL that points to a Key Vault secret which contains a certificate. - The certificate is the Base64 encoding of the following JavaScript Object Notation (JSON) object, which is encoded in UTF-8. - { -"data": "<Base64-encoded-file>", -"dataType": "<file-format>", -"password": "<pfx-file-password>" + + String + + String + + + none + + + SourceImageUri + + Specifies the source URI of the disk that this cmdlet attaches. + + String + + String + + + none + + + InformationAction + + + + ActionPreference + + ActionPreference + + + + + + InformationVariable + + + + String + + String + + + + + + Profile + + Specifies the Azure profile from which this cmdlet reads. If you do not specify a profile, this cmdlet reads from the local default profile. + + azureprofile + + azureprofile + + + none + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Keywords: azure, azurerm, arm, resource, management, manager, compute, vm, iaas + + + + + -------------------------- Example 1: Add data disks to a new virtual machine -------------------------- + + PS C:\> + + PS C:\>$VirtualMachine = New-AzureRmVMConfig -VMName "VirtualMachine07" -VMSize "Standard_A1" +PS C:\> $DataDiskVhdUri01 = "https://contoso.blob.core.windows.net/test/data1.vhd" +PS C:\> $DataDiskVhdUri02 = "https://contoso.blob.core.windows.net/test/data2.vhd" +PS C:\> $DataDiskVhdUri03 = "https://contoso.blob.core.windows.net/test/data3.vhd" +PS C:\> $VirtualMachine = Add-AzureRmVMDataDisk -VM $VirtualMachine -Name 'DataDisk1' -Caching 'ReadOnly' -DiskSizeInGB 10 -Lun 0 -VhdUri $DataDiskVhdUri1 -CreateOption Empty +PS C:\> $VirtualMachine = Add-AzureRmVMDataDisk -VM $VirtualMachine -Name 'DataDisk2' -Caching 'ReadOnly' -DiskSizeInGB 11 -Lun 1 -VhdUri $DataDiskVhdUri2 -CreateOption Empty +PS C:\> $VirtualMachine = Add-AzureRmVMDataDisk -VM $VirtualMachine -Name 'DataDisk3' -Caching 'ReadOnly' -DiskSizeInGB 12 -Lun 2 -VhdUri $DataDiskVhdUri3 -CreateOption Empty + + The first command creates a virtual machine object, and then stores it in the $VirtualMachine variable. The command assigns a name and size to the virtual machine. + + + + + + + + + + + + + + -------------------------- Example 2: Add a data disk to an existing virtual machine -------------------------- + + PS C:\> + + PS C:\>$VirtualMachine = Get-AzureRmVM -ResourceGroupName "ResourceGroup11" -Name "VirtualMachine07" +PS C:\> Add-AzureRmVMDataDisk -VM $VirtualMachine -Name "disk1" -VhdUri "https://contoso.blob.core.windows.net/vhds/diskstandard03.vhd" -LUN 0 -Caching ReadOnly -DiskSizeinGB 1 -CreateOption Empty +PS C:\> Update-AzureRmVM -ResourceGroupName "ResourceGroup11" -Name "VirtualMachine07" -VM $VirtualMachine + + The first command gets the virtual machine named VirtualMachine07 by using the Get-AzureRmVM cmdlet. The command stores the virtual machine in the $VirtualMachine variable. + + + + + + + + + + + + + + + + Remove-AzureRmVMDataDisk + + + + Get-AzureRmVM + + + + New-AzureRmVMConfig + + + + + + + + Add-AzureRmVMNetworkInterface + + Adds a network interface to a virtual machine. + + + + + Add + AzureRmVMNetworkInterface + + + + The Add-AzureRmVMNetworkInterface cmdlet adds a network interface to a virtual machine. You can add an interface when you create a virtual machine or add one to an existing virtual machine. + + + + Add-AzureRmVMNetworkInterface + + VM + + Specifies a local virtual machine object to which to add a network interface. To create a virtual machine, use the New-AzureRmVMConfig cmdlet. To obtain an existing virtual machine, use the Get-AzureRmVM cmdlet. + + PSVirtualMachine + + + Id + + Specifies the ID of a network interface to add to a virtual machine. To obtain a network interface, use the Get-AzureRmNetworkInterface cmdlet. + + String + + + Primary + + Indicates that this cmdlet adds the network interface as the primary interface. + + SwitchParameter + + + InformationAction + + + + ActionPreference + + + InformationVariable + + + + String + + + + Add-AzureRmVMNetworkInterface + + VM + + Specifies a local virtual machine object to which to add a network interface. To create a virtual machine, use the New-AzureRmVMConfig cmdlet. To obtain an existing virtual machine, use the Get-AzureRmVM cmdlet. + + PSVirtualMachine + + + NetworkInterface + + + + List`1[PSNetworkInterface] + + + InformationAction + + + + ActionPreference + + + InformationVariable + + + + String + + + + + + VM + + Specifies a local virtual machine object to which to add a network interface. To create a virtual machine, use the New-AzureRmVMConfig cmdlet. To obtain an existing virtual machine, use the Get-AzureRmVM cmdlet. + + PSVirtualMachine + + PSVirtualMachine + + + none + + + Id + + Specifies the ID of a network interface to add to a virtual machine. To obtain a network interface, use the Get-AzureRmNetworkInterface cmdlet. + + String + + String + + + none + + + Primary + + Indicates that this cmdlet adds the network interface as the primary interface. + + SwitchParameter + + SwitchParameter + + + none + + + InformationAction + + + + ActionPreference + + ActionPreference + + + + + + InformationVariable + + + + String + + String + + + + + + NetworkInterface + + + + List`1[PSNetworkInterface] + + List`1[PSNetworkInterface] + + + + + + Profile + + Specifies the Azure profile from which this cmdlet reads. If you do not specify a profile, this cmdlet reads from the local default profile. + + azureprofile + + azureprofile + + + none + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Keywords: azure, azurerm, arm, resource, management, manager, compute, vm, iaas + + + + + -------------------------- Example 1: Add a network interface to a new virtual machine -------------------------- + + PS C:\> + + PS C:\>$VirtualMachine = New-AzureRmVMConfig -VMName "VirtualMachine07" -VMSize "Standard_A1" +PS C:\> Add-AzureRmVMNetworkInterface -VM $VirtualMachine -Id "/subscriptions/46fc8ea4-2de6-4179-8ab1-365da4121af4/resourceGroups/contoso/providers/Microsoft.Network/networkInterfaces/sshNIC" + + The first command creates a virtual machine object, and then stores it in the $VirtualMachine variable. The command assigns a name and size to the virtual machine. + + + + + + + + + + + + + + -------------------------- Example 2: Add a network interface to an existing virtual machine -------------------------- + + PS C:\> + + PS C:\>$VirtualMachine = Get-AzureRmVM -ResourceGroupName "ResourceGroup11" -Name "VirtualMachine07" +PS C:\> Add-AzureRmVMNetworkInterface -VM $VirtualMachine -Id "/subscriptions/46fc8ea4-2de6-4179-8ab1-365da4121af4/resourceGroups/contoso/providers/Microsoft.Network/networkInterfaces/sshNIC" +PS C:\> Update-AzureRmVM -ResourceGroupName "ResourceGroup11" -Name " VirtualMachine07" -VM $VirtualMachine + + The first command gets the virtual machine named VirtualMachine07 by using the Get-AzureRmVM cmldet. The command stores the virtual machine in the $VirtualMachine variable. + + + + + + + + + + + + + + + + New-AzureRmVMConfig + + + + Get-AzureRmVM + + + + Get-AzureRmAvailabilitySet + + + + + + + + Add-AzureRmVMSecret + + Adds a secret to a virtual machine. + + + + + Add + AzureRmVMSecret + + + + The Add-AzureRmVMSecret cmdlet adds a secret to a virtual machine. This value lets you add a certificate to the virtual machine. The secret needs to be stored in a Key Vault. For more information about Key Vault, see What is Azure Key Vault? (https://azure.microsoft.com/en-us/documentation/articles/key-vault-whatis/) in the Azure library. For more information about the cmdlets, see Azure Key Vault Cmdlets (https://msdn.microsoft.com/library/azure/dn868052.aspx) in the Microsoft Developer Network library or type Get-Help Set-AzureKeyVaultSecret. + + + + Add-AzureRmVMSecret + + VM + + Specifies the virtual machine object that this cmdlet modifies. To obtain a virtual machine object, use the Get-AzureRmVM cmdlet. Create a virtual machine object by using the New-AzureRmVMConfig cmdlet. + + PSVirtualMachine + + + SourceVaultId + + Specifies the resource ID of the Key Vault that contains the certificates that you can add to the virtual machine. This value also acts as the key for adding multiple certificates. This means that you can use the same value for SourceVaultId when you add multiple certificates from the same Key Vault. + + String + + + CertificateStore + + Specifies the name of a certificate store on the virtual machine that runs the Windows operating system. This cmdlet adds the certificate to the store that this parameter specifies. You can only specify this parameter for virtual machines that run the Windows operating system. + + String + + + CertificateUrl + + Specifies the URL that points to a Key Vault secret which contains a certificate. + The certificate is the Base64 encoding of the following JavaScript Object Notation (JSON) object, which is encoded in UTF-8. + { +"data": "<Base64-encoded-file>", +"dataType": "<file-format>", +"password": "<pfx-file-password>" } - Currently, dataType accepts only .pfx files. - - String - - - Profile - - Specifies the Azure profile from which this cmdlet reads. If you do not specify a profile, this cmdlet reads from the local default profile. - - AzureProfile - - - - - - CertificateStore - - Specifies the name of a certificate store on the virtual machine that runs the Windows operating system. This cmdlet adds the certificate to the store that this parameter specifies. You can only specify this parameter for virtual machines that run the Windows operating system. - - String - - String - - - none - - - CertificateUrl - - Specifies the URL that points to a Key Vault secret which contains a certificate. - The certificate is the Base64 encoding of the following JavaScript Object Notation (JSON) object, which is encoded in UTF-8. - { -"data": "<Base64-encoded-file>", -"dataType": "<file-format>", -"password": "<pfx-file-password>" + Currently, dataType accepts only .pfx files. + + String + + + InformationAction + + + + ActionPreference + + + InformationVariable + + + + String + + + + + + VM + + Specifies the virtual machine object that this cmdlet modifies. To obtain a virtual machine object, use the Get-AzureRmVM cmdlet. Create a virtual machine object by using the New-AzureRmVMConfig cmdlet. + + PSVirtualMachine + + PSVirtualMachine + + + none + + + SourceVaultId + + Specifies the resource ID of the Key Vault that contains the certificates that you can add to the virtual machine. This value also acts as the key for adding multiple certificates. This means that you can use the same value for SourceVaultId when you add multiple certificates from the same Key Vault. + + String + + String + + + none + + + CertificateStore + + Specifies the name of a certificate store on the virtual machine that runs the Windows operating system. This cmdlet adds the certificate to the store that this parameter specifies. You can only specify this parameter for virtual machines that run the Windows operating system. + + String + + String + + + none + + + CertificateUrl + + Specifies the URL that points to a Key Vault secret which contains a certificate. + The certificate is the Base64 encoding of the following JavaScript Object Notation (JSON) object, which is encoded in UTF-8. + { +"data": "<Base64-encoded-file>", +"dataType": "<file-format>", +"password": "<pfx-file-password>" } - Currently, dataType accepts only .pfx files. - - String - - String - - - none - - - Profile - - Specifies the Azure profile from which this cmdlet reads. If you do not specify a profile, this cmdlet reads from the local default profile. - - AzureProfile - - AzureProfile - - - none - - - SourceVaultId - - Specifies the resource ID of the Key Vault that contains the certificates that you can add to the virtual machine. This value also acts as the key for adding multiple certificates. This means that you can use the same value for SourceVaultId when you add multiple certificates from the same Key Vault. - - String - - String - - - none - - - VM - - Specifies the virtual machine object that this cmdlet modifies. To obtain a virtual machine object, use the Get-AzureRmVM cmdlet. Create a virtual machine object by using the New-AzureRmVMConfig cmdlet. - - PSVirtualMachine - - PSVirtualMachine - - - none - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Example 1: Add a secret to a virtual machine - - - - - PS C:\>$VirtualMachine = New-AzureRmVMConfig -VMName "VirtualMachine07" -VMSize "Standard_A1" -AvailabilitySetID $AvailabilitySet.Id + Currently, dataType accepts only .pfx files. + + String + + String + + + none + + + InformationAction + + + + ActionPreference + + ActionPreference + + + + + + InformationVariable + + + + String + + String + + + + + + Profile + + Specifies the Azure profile from which this cmdlet reads. If you do not specify a profile, this cmdlet reads from the local default profile. + + azureprofile + + azureprofile + + + none + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Keywords: azure, azurerm, arm, resource, management, manager, compute, vm, iaas + + + + + -------------------------- Example 1: Add a secret to a virtual machine -------------------------- + + PS C:\> + + PS C:\>$VirtualMachine = New-AzureRmVMConfig -VMName "VirtualMachine07" -VMSize "Standard_A1" -AvailabilitySetID $AvailabilitySet.Id PS C:\> $Credential = Get-Credential -PS C:\> $VirtualMachine = Set-AzureRmVMOperatingSystem -VM $VirtualMachine -Windows -ComputerName "Contoso26" -Credential $Credential -PS C:\> $SourceVaultId = "/subscriptions/46f8cea4-2de6-4179-8ab1-365da4211af4/resourceGroups/vault/providers/Microsoft.KeyVault/vaults/keyvault" -PS C:\> $CertificateStore01 = "My" -PS C:\> $CertificateUrl01 = "https://contosovault.vault.azure.net/secrets/514ceb769c984379a7e0230bdd703272" -PS C:\> $VirtualMachine = Add-AzureRmVMSecret -VM $VirtualMachine -SourceVaultId $SourceVaultId -CertificateStore $CertificateStore01 -CertificateUrl $CertificateUrl01 - - - - - The first command creates a virtual machine object, and then stores it in the $VirtualMachine variable. The command assigns a name and size to the virtual machine. - The third command creates a credential object by using the Get-Credential cmdlet, and then stores the result in the $Credential variable. The command prompts you for a user name and password. For more information, type Get-Help Get-Credential. - The fourth command uses the Set-AzureRmVMOperatingSystem cmdlet to configure the virtual machine stored in $VirtualMachine. - The fifth command assigns a source vault ID to the $SourceVaultId variable for later use. The command assumes that the $SubscriptionId variable has an appropriate value. - The sixth command assigns a value to the $CertificateStore01 variable for later use. - The seventh command assigns a URL for a certificate store. - The eighth command adds a secret to the virtual machine stored in $VirtualMachine. The SourceVaultId parameter specifies the Key Vault. The command specifies the name of the certificate store and the URL of the certificate. You can run the Add-AzureRmVMSecret repeatedly to add secrets for other certificates. - - - - - - - - - - - - - - - Keywords: azure, azurerm, arm, resource, management, manager, compute, vm, iaas - - - - - - Add-AzureRmVMSshPublicKey - - Adds the public keys for SSH for a virtual machine. - - - - - Add - AzureVMSshPublicKey - - - - The Add-AzureRmVMSshPublicKey cmdlet adds the public keys that you can use to connect to a virtual machine over Secure Shell (SSH). - - - - Add-AzureRmVMSshPublicKey - - VM - - Specifies the virtual machine object that this cmdlet modifies. To obtain a virtual machine object, use the Get-AzureRmVM cmdlet. Create a virtual machine object by using the New-AzureRmVMConfig cmdlet. - - PSVirtualMachine - - - KeyData - - Specifies a base 64 encoding of a public key. You can connect to a virtual machine by using SSH by using the key that this parameter specifies. - - String - - - Path - - Specifies the full path of a file, on the virtual machine, where this cmdlet stores the SSH public key. If the file already exists, this cmdlet appends the key to the file. - - String - - - Profile - - Specifies the Azure profile from which this cmdlet reads. If you do not specify a profile, this cmdlet reads from the local default profile. - - AzureProfile - - - - - - KeyData - - Specifies a base 64 encoding of a public key. You can connect to a virtual machine by using SSH by using the key that this parameter specifies. - - String - - String - - - none - - - Path - - Specifies the full path of a file, on the virtual machine, where this cmdlet stores the SSH public key. If the file already exists, this cmdlet appends the key to the file. - - String - - String - - - none - - - Profile - - Specifies the Azure profile from which this cmdlet reads. If you do not specify a profile, this cmdlet reads from the local default profile. - - AzureProfile - - AzureProfile - - - none - - - VM - - Specifies the virtual machine object that this cmdlet modifies. To obtain a virtual machine object, use the Get-AzureRmVM cmdlet. Create a virtual machine object by using the New-AzureRmVMConfig cmdlet. - - PSVirtualMachine - - PSVirtualMachine - - - none - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Example 1: Add a public key to a virtual machine - - - - - PS C:\>$VirtualMachine = Get-AzureRmVM -ResourceGroupName "ResourceGroup11" -Name "VirtualMachine07" -PS C:\> $VirtualMachine = Add-AzureRmVMSshPublicKey -VM $VirtualMachine -KeyData "MIIDszCCApugAwIBAgIJALBV9YJCF/tAMA0GCSq12Ib3DQEB21QUAMEUxCzAJBgNV" -Path "/home/admin/.ssh/authorized_keys" - - - The first command gets the virtual machine named VirtualMachine07 by using the Get-AzureRmVM cmdlet. The command stores the virtual machine in the $VirtualMachine variable. - The second command adds the public key to the location on VirtualMachine07 that the Path parameter specifies. - - - - - - - - - - - - - Get-AzureRmVM - - - - - - Keywords: azure, azurerm, arm, resource, management, manager, compute, vm, iaas - - - - - - Get-AzureRmAvailabilitySet - - Gets Azure availability sets in a resource group. - - - - - Get - AzureAvailabilitySet - - - - The Get-AzureRmAvailabilitySet cmdlet gets Azure availability sets in a resource group. Specify the name of a specific availability set to get. - - - - Get-AzureRmAvailabilitySet - - ResourceGroupName - - Specifies the name of a resource group. - - String - - - Name - - Specifies the name of an availability set to get. - - String - - - Profile - - Specifies the Azure profile from which this cmdlet reads. If you do not specify a profile, this cmdlet reads from the local default profile. - - AzureProfile - - - - - - Name - - Specifies the name of an availability set to get. - - String - - String - - - none - - - Profile - - Specifies the Azure profile from which this cmdlet reads. If you do not specify a profile, this cmdlet reads from the local default profile. - - AzureProfile - - AzureProfile - - - none - - - ResourceGroupName - - Specifies the name of a resource group. - - String - - String - - - none - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Example 1: Get a specific availability set - - - - - PS C:\>Get-AzureRmAvailabilitySet -ResourceGroupName "ResourceGroup11" -Name "AvailabilitySet03" - - - This command gets the availability set named AvailablitySet03 in the resource group named ResourceGroup11. - - - - - - - - - - - Example 2: Get all availability sets - - - - - PS C:\>Get-AzureRmAvailabilitySet -ResourceGroupName "ResourceGroup11" - - - This command gets all the availability sets in the resource group named ResourceGroup11. - - - - - - - - - - - - - New-AzureRmAvailabilitySet - - - - Remove-AzureRmAvailabilitySet - - - - - - Keywords: azure, azurerm, arm, resource, management, manager, compute, vm, iaas - - - - - - Get-AzureRmRemoteDesktopFile - - Gets an .rdp file. - - - - - Get - AzureRemoteDesktopFile - - - - The Get-AzureRmRemoteDesktopFile cmdlet gets a Remote Desktop Protocol (.rdp) file. - - - - Get-AzureRmRemoteDesktopFile - - ResourceGroupName - - Specifies the name of a resource group. - - String - - - Name - - Specifies the name of the availability set that this cmdlet gets. - - String - - - LocalPath - - Specifies the local full path where this cmdlet stores the .rdp file. - - String - - - Profile - - Specifies the Azure profile from which this cmdlet reads. If you do not specify a profile, this cmdlet reads from the local default profile. - - AzureProfile - - - - - - LocalPath - - Specifies the local full path where this cmdlet stores the .rdp file. - - String - - String - - - none - - - Name - - Specifies the name of the availability set that this cmdlet gets. - - String - - String - - - none - - - Profile - - Specifies the Azure profile from which this cmdlet reads. If you do not specify a profile, this cmdlet reads from the local default profile. - - AzureProfile - - AzureProfile - - - none - - - ResourceGroupName - - Specifies the name of a resource group. - - String - - String - - - none - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Example 1: Get a Remote Desktop file - - - - - PS C:\>Get-AzureRmRemoteDesktopFile -ResourceGroupName "ResourceGroup11" -Name "VirtualMachine07" -LocalPath "D:\RemoteDesktopFile07.rdp" - - - This command gets the Remote Desktop file for the virtual machine named VirtualMachine07. The command stores the result in the file named D:\RemoteDesktopFile07.rdp. - - - - - - - - - - - - - - - Keywords: azure, azurerm, arm, resource, management, manager, compute, vm, iaas - - - - - - Get-AzureRmVMAccessExtension - - Gets information about the VMAccess extension. - - - - - Get - AzureVMAccessExtension - - - - The Get-AzureRmVMAccessExtension cmdlet gets information about the Virtual Machine Access (VMAccess) Virtual Machine Extension. - - - - Get-AzureRmVMAccessExtension - - ResourceGroupName - - Specifies the name of the resource group of the virtual machine. - - String - - - VMName - - Specifies the name of a virtual machine. This cmdlet gets information about VMAccess for the virtual machine that this parameter specifies. - - String - - - Name - - Specifies the name of the extension that this cmdlet gets. - - String - - - Status - - Indicates that this cmdlet gets only the instance view of the extension. - - - - Profile - - Specifies the Azure profile from which this cmdlet reads. If you do not specify a profile, this cmdlet reads from the local default profile. - - AzureProfile - - - - - - Name - - Specifies the name of the extension that this cmdlet gets. - - String - - String - - - none - - - Profile - - Specifies the Azure profile from which this cmdlet reads. If you do not specify a profile, this cmdlet reads from the local default profile. - - AzureProfile - - AzureProfile - - - none - - - ResourceGroupName - - Specifies the name of the resource group of the virtual machine. - - String - - String - - - none - - - Status - - Indicates that this cmdlet gets only the instance view of the extension. - - SwitchParameter - - SwitchParameter - - - none - - - VMName - - Specifies the name of a virtual machine. This cmdlet gets information about VMAccess for the virtual machine that this parameter specifies. - - String - - String - - - none - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Example 1: Get the VMAccess extension - - - - - PS C:\>$VMAccessExtension = Get-AzureRmVMAccessExtension -ResourceGroupName "ResourceGroup11" -VMName "VirtualMachine07" -Name "ContosoTest" - - - This command gets the VMAccess extension named ContosoTest for the virtual machine named VirtualMachine07. - - - - - - - - - - - Example 2: Get the instance view of the VMAccess extension - - - - - PS C:\>$VMAccessExtension = Get-AzureRmVMAccessExtension -ResourceGroupName "ResourceGroup11" -VMName "VirtualMachine0" -Name "ContosoTest" -Status - - - This command gets the instance view of the VMAccess extension named ContosoTest for the virtual machine named VirtualMachine07. - - - - - - - - - - - - - Remove-AzureRmVMAccessExtension - - - - Set-AzureRmVMAccessExtension - - - - Get-AzureRmVMExtension - - - - - - Keywords: azure, azurerm, arm, resource, management, manager, compute, vm, iaas - - - - - - Get-AzureRmVMCustomScriptExtension - - Gets information about a custom script extension. - - - - - Get - AzureVMCustomScriptExtension - - - - The Get-AzureRmVMCustomScriptExtension cmdlet gets information about a custom script Virtual Machine Extension on a virtual machine. - - - - Get-AzureRmVMCustomScriptExtension - - ResourceGroupName - - Specifies the name of the resource group of the virtual machine. - - String - - - VMName - - Specifies the name of a virtual machine for which this cmdlet gets the custom script extension. - - String - - - Name - - Specifies the name of the custom script extension about which this cmdlet gets information. - - String - - - Status - - Indicates that this cmdlet gets the instance view of the custom script extension. - - - - Profile - - Specifies the Azure profile from which this cmdlet reads. If you do not specify a profile, this cmdlet reads from the local default profile. - - AzureProfile - - - - - - Name - - Specifies the name of the custom script extension about which this cmdlet gets information. - - String - - String - - - none - - - Profile - - Specifies the Azure profile from which this cmdlet reads. If you do not specify a profile, this cmdlet reads from the local default profile. - - AzureProfile - - AzureProfile - - - none - - - ResourceGroupName - - Specifies the name of the resource group of the virtual machine. - - String - - String - - - none - - - Status - - Indicates that this cmdlet gets the instance view of the custom script extension. - - SwitchParameter - - SwitchParameter - - - none - - - VMName - - Specifies the name of a virtual machine for which this cmdlet gets the custom script extension. - - String - - String - - - none - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Example 1: Get a custom script extension - - - - - PS C:\>$VMCustomScriptExtension = Get-AzureRmVMCustomScriptExtension -ResourceGroupName "ResourceGroup11" -VMName "VirtualMachine07" -Name "ContosoCustomScript" - - - This command gets the custom script extension named ContosoCustomScript for the virtual machine named VirtualMachine07. - - - - - - - - - - - Example 2: Get the instance view of a custom script extension - - - - - PS C:\>$VMCustomScriptExtension = Get-AzureRmVMCustomScriptExtension -ResourceGroupName "ResourceGroup11" -VMName "VirtualMachine07" -Name "ContosoCustomScript" -Status - - - This command gets the instance view of the custom script extension named ContosoCustomScript for the virtual machine named VirtualMachine07. - - - - - - - - - - - - - Get-AzureRmVMExtension - - - - Get-AzureRmVMExtensionImage - - - - Get-AzureRmVMAccessExtension - - - - - - Keywords: azure, azurerm, arm, resource, management, manager, compute, vm, iaas - - - - - - Get-AzureRmVMExtensionImageDetail - - This cmdlet has been deprecated. - - - - - Get - AzureVMExtensionImageDetail - - - - This Get-AzureRmVMExtensionImageDetail cmdlet has been deprecated. - - - - Get-AzureRmVMExtensionImageDetail - - FilterExpression - - - String - - - Profile - - - AzureProfile - - - Version - - - String - - - Location - - - String - - - PublisherName - - - String - - - Type - - - String - - - - - - FilterExpression - - - String - - String - - - none - - - Location - - - String - - String - - - none - - - Profile - - - AzureProfile - - AzureProfile - - - none - - - PublisherName - - - String - - String - - - none - - - Type - - - String - - String - - - none - - - Version - - - String - - String - - - none - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 1: - - - - - PS C:\> - - - - - - - - - - - - - - - - - - - Keywords: azure, azurerm, arm, resource, management, manager, compute, vm, iaas - - - - - - Get-AzureRmVMExtensionImageType - - Gets the type of an Azure extension. - - - - - Get - AzureVMExtensionImageType - - - - The Get-AzureRmVMExtensionImageType cmdlet gets the type of an Azure extension. - - - - Get-AzureRmVMExtensionImageType - - Profile - - Specifies the Azure profile from which this cmdlet reads. If you do not specify a profile, this cmdlet reads from the local default profile. - - AzureProfile - - - Location - - Specifies the location of an extension. This cmdlet gets the type for an extension at the location that this parameter specifies. - - String - - - PublisherName - - Specifies the name of a publisher of an extension. To obtain an extension publisher, use the Get-AzureRmVMImagePublisher cmdlet. This cmdlet gets the type for an extension from the publisher that this parameter specifies. - - String - - - - - - Location - - Specifies the location of an extension. This cmdlet gets the type for an extension at the location that this parameter specifies. - - String - - String - - - none - - - Profile - - Specifies the Azure profile from which this cmdlet reads. If you do not specify a profile, this cmdlet reads from the local default profile. - - AzureProfile - - AzureProfile - - - none - - - PublisherName - - Specifies the name of a publisher of an extension. To obtain an extension publisher, use the Get-AzureRmVMImagePublisher cmdlet. This cmdlet gets the type for an extension from the publisher that this parameter specifies. - - String - - String - - - none - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Example 1: Get an extension image type - - - - - PS C:\>Get-AzureRmVMExtensionImageType -Location "Central US" -PublisherName "Fabrikam" - - - This command gets the extension image type for the specified publisher and location. - - - - - - - - - - - - - Get-AzureRmVMExtensionImage - - - - - - Keywords: azure, azurerm, arm, resource, management, manager, compute, vm, iaas - - - - - - Get-AzureRmVMExtensionImage - - Gets all versions for an Azure extension. - - - - - Get - AzureVMExtensionImage - - - - The Get-AzureRmVMExtensionImage cmdlet gets all versions for an Azure extension. - - - - Get-AzureRmVMExtensionImage - - FilterExpression - - Specifies a filter expression. - - String - - - Profile - - Specifies the Azure profile from which this cmdlet reads. If you do not specify a profile, this cmdlet reads from the local default profile. - - AzureProfile - - - Version - - - - - System.String - - - Location - - Specifies the location of an extension. - - String - - - PublisherName - - Specifies the name of an extension publisher. To obtain an extension publisher, use the Get-AzureRmVMImagePublisher cmdlet. - - String - - - Type - - Specifies the type of the extension. To obtain an extension type, use the Get-AzureRmVMExtensionImageType cmdlet. - - String - - - - - - FilterExpression - - Specifies a filter expression. - - String - - String - - - none - - - Location - - Specifies the location of an extension. - - String - - String - - - none - - - Profile - - Specifies the Azure profile from which this cmdlet reads. If you do not specify a profile, this cmdlet reads from the local default profile. - - AzureProfile - - AzureProfile - - - none - - - PublisherName - - Specifies the name of an extension publisher. To obtain an extension publisher, use the Get-AzureRmVMImagePublisher cmdlet. - - String - - String - - - none - - - Type - - Specifies the type of the extension. To obtain an extension type, use the Get-AzureRmVMExtensionImageType cmdlet. - - String - - String - - - none - - - Version - - - - - System.String - - System.String - - - none - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Example 1: Get the versions of an extension image - - - - - PS C:\>Get-AzureRmVMExtensionImage -Location "Central US" -PublisherName "Fabrikam" -Type "FabrikamEndpointProtection" - - - This command gets all the versions of the extension image for the specified location, publisher, and type. - - - - - - - - - - - - - Get-AzureRmVMExtensionImageType - - - - Get-AzureRmVMImage - - - - Get-AzureRmVMImagePublisher - - - - Get-AzureRmVMExtensionImageType - - - - - - Keywords: azure, azurerm, arm, resource, management, manager, compute, vm, iaas - - - - - - Get-AzureRmVMExtension - - Gets properties of Virtual Machine Extensions installed on a virtual machine. - - - - - Get - AzureVMExtension - - - - The Get-AzureRmVMExtension cmdlet gets properties of Virtual Machine Extensions installed on a virtual machine. Specify the name of an extension for which to get properties. To get only the instance view of an extension, specify the Status parameter. - - - - Get-AzureRmVMExtension - - ResourceGroupName - - Specifies the name of a resource group. - - String - - - VMName - - Specifies the name of a virtual machine. This cmdlet gets properties of an extension from the virtual machine that this parameter specifies. - - String - - - Name - - Specifies the name of an extension. This cmdlet gets properties for the extension that this parameter specifies. - - String - - - Status - - Indicates that this cmdlet gets only the instance view of an extension. - - - - Profile - - Specifies the Azure profile from which this cmdlet reads. If you do not specify a profile, this cmdlet reads from the local default profile. - - AzureProfile - - - - - - Name - - Specifies the name of an extension. This cmdlet gets properties for the extension that this parameter specifies. - - String - - String - - - none - - - Profile - - Specifies the Azure profile from which this cmdlet reads. If you do not specify a profile, this cmdlet reads from the local default profile. - - AzureProfile - - AzureProfile - - - none - - - ResourceGroupName - - Specifies the name of a resource group. - - String - - String - - - none - - - Status - - Indicates that this cmdlet gets only the instance view of an extension. - - SwitchParameter - - SwitchParameter - - - none - - - VMName - - Specifies the name of a virtual machine. This cmdlet gets properties of an extension from the virtual machine that this parameter specifies. - - String - - String - - - none - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Example 1: Get properties of an extension - - - - - PS C:\>Get-AzureRmVMExtension -ResourceGroupName "ResourceGroup11" -VMName "VirtualMachine22" -Name "CustomScriptExtension" - - - This command gets properties for the extension named CustomScriptExtension on the virtual machine named VirtualMachine22 in the resource group ResourceGroup11. - - - - - - - - - - - Example 2: Get instance view of an extension - - - - - PS C:\>Get-AzureRmVMExtension -ResourceGroupName "ResourceGroup11" -VMName "VirtualMachine22" -Name "CustomScriptExtension" -Status - - - This command gets the instance view for the extension named CustomScriptExtension on the virtual machine named VirtualMachine22 in the resource group ResourceGroup11. - - - - - - - - - - - - - Remove-AzureRmVMExtension - - - - Set-AzureRmVMExtension - - - - - - Keywords: azure, azurerm, arm, resource, management, manager, compute, vm, iaas - - - - - - Get-AzureRmVMImageDetail - - This cmdlet has been deprecated. - - - - - Get - AzureVMImageDetail - - - - The Get-AzureRmVMImageDetail cmdlet has been deprecated. - - - - Get-AzureRmVMImageDetail - - Profile - - - AzureProfile - - - Location - - - String - - - Offer - - - String - - - PublisherName - - - String - - - Skus - - - String - - - Version - - - String - - - - - - Location - - - String - - String - - - none - - - Offer - - - String - - String - - - none - - - Profile - - - AzureProfile - - AzureProfile - - - none - - - PublisherName - - - String - - String - - - none - - - Skus - - - String - - String - - - none - - - Version - - - String - - String - - - none - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 1: - - - - - PS C:\> - - - - - - - - - - - - - - - - - - - Keywords: azure, azurerm, arm, resource, management, manager, compute, vm, iaas - - - - - - Get-AzureRmVMImageOffer - - Gets VMImage offer types. - - - - - Get - AzureVMImageOffer - - - - The Get-AzureRmVMImageOffer cmdlet gets the VMImage offer types. - - - - Get-AzureRmVMImageOffer - - Profile - - Specifies the Azure profile from which this cmdlet reads. If you do not specify a profile, this cmdlet reads from the local default profile. - - AzureProfile - - - Location - - Specifies the location of the VMImage. - - String - - - PublisherName - - Specifies the name of a publisher of a VMImage. To obtain a publisher, use the Get-AzureRmVMImagePublisher cmdlet. - - String - - - - - - Location - - Specifies the location of the VMImage. - - String - - String - - - none - - - Profile - - Specifies the Azure profile from which this cmdlet reads. If you do not specify a profile, this cmdlet reads from the local default profile. - - AzureProfile - - AzureProfile - - - none - - - PublisherName - - Specifies the name of a publisher of a VMImage. To obtain a publisher, use the Get-AzureRmVMImagePublisher cmdlet. - - String - - String - - - none - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Example 1: Get offer types for a publisher - - - - - PS C:\>Get-AzureRmVMImageOffer -Location "Central US" -PublisherName "Fabrikam" - - - This command gets the offer types for the specified publisher in the Central US region. - - - - - - - - - - - - - Get-AzureRmVMImage - - - - Get-AzureRmVMImagePublisher - - - - Get-AzureRmVMImageSku - - - - Save-AzureRmVMImage - - - - - - Keywords: azure, azurerm, arm, resource, management, manager, compute, vm, iaas - - - - - - Get-AzureRmVMImagePublisher - - Gets the VMImage publishers. - - - - - Get - AzureVMImagePublisher - - - - The Get-AzureRmVMImagePublisher cmdlet gets the VMImage publishers. - - - - Get-AzureRmVMImagePublisher - - Profile - - Specifies the Azure profile from which this cmdlet reads. If you do not specify a profile, this cmdlet reads from the local default profile. - - AzureProfile - - - Location - - Specifies the location of the VMImage. - - String - - - - - - Location - - Specifies the location of the VMImage. - - String - - String - - - none - - - Profile - - Specifies the Azure profile from which this cmdlet reads. If you do not specify a profile, this cmdlet reads from the local default profile. - - AzureProfile - - AzureProfile - - - none - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Example 1: Get VMImage publishers for a region - - - - - PS C:\>Get-AzureRmVMImagePublisher -Location "Central US" - - - This command gets the publishers of VMImage instances for the Central US region within your profile. - - - - - - - - - - - - - Get-AzureRmVMImage - - - - Get-AzureRmVMImageOffer - - - - Get-AzureRmVMImageSku - - - - Save-AzureRmVMImage - - - - - - Keywords: azure, azurerm, arm, resource, management, manager, compute, vm, iaas - - - - - - Get-AzureRmVMImageSku - - Gets VMImage SKUs. - - - - - Get - AzureVMImageSku - - - - The Get-AzureRmVMImageSku cmdlet gets VMImage SKUs. - - - - Get-AzureRmVMImageSku - - Profile - - Specifies the Azure profile from which this cmdlet reads. If you do not specify a profile, this cmdlet reads from the local default profile. - - AzureProfile - - - Location - - Specifies the location of the VMImage. - - String - - - Offer - - Specifies the type of VMImage offer. - - String - - - PublisherName - - Specifies the publisher of a VMImage. - - String - - - - - - Location - - Specifies the location of the VMImage. - - String - - String - - - none - - - Offer - - Specifies the type of VMImage offer. - - String - - String - - - none - - - Profile - - Specifies the Azure profile from which this cmdlet reads. If you do not specify a profile, this cmdlet reads from the local default profile. - - AzureProfile - - AzureProfile - - - none - - - PublisherName - - Specifies the publisher of a VMImage. - - String - - String - - - none - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Example 1: Get SKUs - - - - - PS C:\>Get-AzureRmVMImageSku -Location "Central US" -PublisherName "Fabrikam" -Offer "LinuxServer" - - - This command gets the SKUs for the specified publisher and offer. - - - - - - - - - - - - - Get-AzureRmVMImage - - - - Get-AzureRmVMImageOffer - - - - Get-AzureRmVMImagePublisher - - - - Save-AzureRmVMImage - - - - - - Keywords: azure, azurerm, arm, resource, management, manager, compute, vm, iaas - - - - - - Get-AzureRmVMImage - - Gets all the versions of a VMImage. - - - - - Get - AzureVMImage - - - - The Get-AzureRmVMImage cmdlet gets all the versions of a VMImage. - - - - Get-AzureRmVMImage - - FilterExpression - - Specifies a filter expression. - - System.String - - - Profile - - Specifies the Azure profile from which this cmdlet reads. If you do not specify a profile, this cmdlet reads from the local default profile. - - Microsoft.Azure.Common.Authentication.Models.AzureProfile - - - Location - - Specifies the location of a VMImage. - - System.String - - - Offer - - Specifies the type of VMImage offer. To obtain an image offer, use the Get-AzureRmVMImageOffer cmdlet. - - System.String - - - PublisherName - - Specifies the publisher of a VMImage. To obtain an image publisher, use the Get-AzureRmVMImagePublisher cmdlet. - - System.String - - - Skus - - Specifies a VMImage SKU. To obtain an SKU, use the Get-AzureRmVMImageSku cmdlet. - - System.String - - - - Get-AzureRmVMImage - - Profile - - Specifies the Azure profile from which this cmdlet reads. If you do not specify a profile, this cmdlet reads from the local default profile. - - Microsoft.Azure.Common.Authentication.Models.AzureProfile - - - Location - - Specifies the location of a VMImage. - - System.String - - - Offer - - Specifies the type of VMImage offer. To obtain an image offer, use the Get-AzureRmVMImageOffer cmdlet. - - System.String - - - PublisherName - - Specifies the publisher of a VMImage. To obtain an image publisher, use the Get-AzureRmVMImagePublisher cmdlet. - - System.String - - - Skus - - Specifies a VMImage SKU. To obtain an SKU, use the Get-AzureRmVMImageSku cmdlet. - - System.String - - - Version - - - - - System.String - - - - - - FilterExpression - - Specifies a filter expression. - - System.String - - System.String - - - none - - - Location - - Specifies the location of a VMImage. - - System.String - - System.String - - - none - - - Offer - - Specifies the type of VMImage offer. To obtain an image offer, use the Get-AzureRmVMImageOffer cmdlet. - - System.String - - System.String - - - none - - - Profile - - Specifies the Azure profile from which this cmdlet reads. If you do not specify a profile, this cmdlet reads from the local default profile. - - Microsoft.Azure.Common.Authentication.Models.AzureProfile - - Microsoft.Azure.Common.Authentication.Models.AzureProfile - - - none - - - PublisherName - - Specifies the publisher of a VMImage. To obtain an image publisher, use the Get-AzureRmVMImagePublisher cmdlet. - - System.String - - System.String - - - none - - - Skus - - Specifies a VMImage SKU. To obtain an SKU, use the Get-AzureRmVMImageSku cmdlet. - - System.String - - System.String - - - none - - - Version - - - - - System.String - - System.String - - - none - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Example 1: Get VMImage objects - - - - - PS C:\>Get-AzureRmVMImage -Location "Central US" -PublisherName "Canonical" -Offer "UbuntuServer" -Skus "15.04-DAILY" - - - This command gets all the versions of VMImage that match the specified values. - - - - - - - - - - - - - Get-AzureRmVMImageOffer - - - - Get-AzureRmVMImagePublisher - - - - Get-AzureRmVMImageSku - - - - Save-AzureRmVMImage - - - - - - Keywords: azure, azurerm, arm, resource, management, manager, compute, vm, iaas - - - - - - Get-AzureRmVMSize - - Gets available virtual machine sizes. - - - - - Get - AzureVMSize - - - - The Get-AzureRmVMSize cmdlet gets available virtual machine sizes. - - - - Get-AzureRmVMSize - - ResourceGroupName - - Specifies the name of the resource group of the virtual machine. - - String - - - AvailabilitySetName - - Specifies the name of the Availability Set for which this cmdlet gets the available virtual machine sizes. - - String - - - Profile - - Specifies the Azure profile from which this cmdlet reads. If you do not specify a profile, this cmdlet reads from the local default profile. - - AzureProfile - - - - Get-AzureRmVMSize - - Location - - Specifies the location for which this cmdlet gets the available virtual machine sizes. - - String - - - Profile - - Specifies the Azure profile from which this cmdlet reads. If you do not specify a profile, this cmdlet reads from the local default profile. - - AzureProfile - - - - Get-AzureRmVMSize - - ResourceGroupName - - Specifies the name of the resource group of the virtual machine. - - String - - - VMName - - Specifies the name of the virtual machine that this cmdlet gets the available virtual machine sizes for resizing. - - String - - - Profile - - Specifies the Azure profile from which this cmdlet reads. If you do not specify a profile, this cmdlet reads from the local default profile. - - AzureProfile - - - - - - AvailabilitySetName - - Specifies the name of the Availability Set for which this cmdlet gets the available virtual machine sizes. - - String - - String - - - none - - - Location - - Specifies the location for which this cmdlet gets the available virtual machine sizes. - - String - - String - - - none - - - Profile - - Specifies the Azure profile from which this cmdlet reads. If you do not specify a profile, this cmdlet reads from the local default profile. - - AzureProfile - - AzureProfile - - - none - - - ResourceGroupName - - Specifies the name of the resource group of the virtual machine. - - String - - String - - - none - - - VMName - - Specifies the name of the virtual machine that this cmdlet gets the available virtual machine sizes for resizing. - - String - - String - - - none - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Example 1: Get sizes for a location - - - - - PS C:\>Get-AzureRmVMSize -Location "Central US" - - - - This command gets the available sizes for virtual machines in the specified location. - - - - - - - - - - - Example 2: Get sizes for an availability set - - - - - PS C:\>Get-AzureRmVMSize -ResourceGroupName "ResourceGroup03" -AvailabilitySetName "AvailabilitySet17" - - - - This command gets available sizes for virtual machines that you can deploy in the availability set named AvailabilitySet17. - - - - - - - - - - - Example 3: Get sizes for an existing virtual machine - - - - - PS C:\>Get-AzureRmVMSize -ResourceGroupName "ResourceGroup03" -VMName "VirtualMachine12" - - - - This command gets available sizes for the existing virtual machine named VirtualMachine12. You can resize this virtual machine to the sizes that this command gets. - - - - - - - - - - - - - Get-AzureRmVM - - - - - - Keywords: azure, azurerm, arm, resource, management, manager, compute, vm, iaas - - - - - - Get-AzureRmVMUsage - - Gets the virtual machine core count usage for a location. - - - - - Get - AzureVMUsage - - - - The Get-AzureRmVMUsage cmdlet gets the virtual machine core count usage for a location. - - - - Get-AzureRmVMUsage - - Location - - Specifies the location for which this cmdlet gets virtual machine core count usage. - - String - - - Profile - - Specifies the Azure profile from which this cmdlet reads. If you do not specify a profile, this cmdlet reads from the local default profile. - - AzureProfile - - - - - - Location - - Specifies the location for which this cmdlet gets virtual machine core count usage. - - String - - String - - - none - - - Profile - - Specifies the Azure profile from which this cmdlet reads. If you do not specify a profile, this cmdlet reads from the local default profile. - - AzureProfile - - AzureProfile - - - none - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Example 1: Get core count usage for a location - - - - - PS C:\>Get-AzureRmVMUsage -Location "Central US" - - - This command gets the virtual machine core count usage for the location Central US. - - - - - - - - - - - - - - - Keywords: azure, azurerm, arm, resource, management, manager, compute, vm, iaas - - - - - - Get-AzureRmVM - - Gets the properties of a virtual machine. - - - - - Get - AzureVM - - - - The Get-AzureRmVM cmdlet gets the model view and instance view of an Azure virtual machine. The model view is the user specified properties of the virtual machine. The instance view is the instance level status of the virtual machine. To get only the instance view of a virtual machine, specify the Status parameter. - - - - Get-AzureRmVM - - ResourceGroupName - - Specifies the name of a resource group. - - System.String - - - Name - - Specifies the name of the virtual machine to get. - - System.String - - - Status - - Indicates that this cmdlet gets only the instance view of the virtual machine. - - - - Profile - - Specifies the Azure profile from which this cmdlet reads. If you do not specify a profile, this cmdlet reads from the local default profile. - - Microsoft.Azure.Common.Authentication.Models.AzureProfile - - - - Get-AzureRmVM - - NextLink - - Specifies the next link. - - System.Uri - - - Profile - - Specifies the Azure profile from which this cmdlet reads. If you do not specify a profile, this cmdlet reads from the local default profile. - - Microsoft.Azure.Common.Authentication.Models.AzureProfile - - - - Get-AzureRmVM - - Profile - - Specifies the Azure profile from which this cmdlet reads. If you do not specify a profile, this cmdlet reads from the local default profile. - - Microsoft.Azure.Common.Authentication.Models.AzureProfile - - - - Get-AzureRmVM - - ResourceGroupName - - Specifies the name of a resource group. - - System.String - - - Profile - - Specifies the Azure profile from which this cmdlet reads. If you do not specify a profile, this cmdlet reads from the local default profile. - - Microsoft.Azure.Common.Authentication.Models.AzureProfile - - - - - - Name - - Specifies the name of the virtual machine to get. - - System.String - - System.String - - - none - - - NextLink - - Specifies the next link. - - System.Uri - - System.Uri - - - none - - - Profile - - Specifies the Azure profile from which this cmdlet reads. If you do not specify a profile, this cmdlet reads from the local default profile. - - Microsoft.Azure.Common.Authentication.Models.AzureProfile - - Microsoft.Azure.Common.Authentication.Models.AzureProfile - - - none - - - ResourceGroupName - - Specifies the name of a resource group. - - System.String - - System.String - - - none - - - Status - - Indicates that this cmdlet gets only the instance view of the virtual machine. - - SwitchParameter - - SwitchParameter - - - none - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Example 1: Get model and instance view properties - - - - - PS C:\>Get-AzureRmVM -ResourceGroupName "ResourceGroup11" -Name "VirtualMachine07" - - - This command gets the model view and instance view properties of the virtual machine named VirtualMachine07. - - - - - - - - - - - Example 2: Get instance view properties - - - - - PS C:\>Get-AzureRmVM -ResourceGroupName "ResourceGroup11" -Name "VirtualMachine07" -Status - - - This command gets properties of the virtual machine named VirtualMachine07. This command specifies the Status parameter. Therefore, the command gets only the instance view properties. - - - - - - - - - - - Example 3: Get properties for all virtual machines in a resource group - - - - - PS C:\> Get-AzureRmVM -ResourceGroupName "ResourceGroup11" - - - This command gets properties for all the virtual machines in the resource group named ResourceGroup11. - - - - - - - - - - - Example 4: Get all virtual machines in your subscription - - - - - PS C:\>Get-AzureRmVM - - - - This command gets all the virtual machines in your subscription. - - - - - - - - - - - - - New-AzureRmVM - - - - Remove-AzureRmVM - - - - Restart-AzureRmVM - - - - Start-AzureRmVM - - - - Stop-AzureRmVM - - - - Update-AzureRmVM - - - - - - Keywords: azure, azurerm, arm, resource, management, manager, compute, vm, iaas - - - - - - New-AzureRmAvailabilitySet - - Creates an Azure availability set. - - - - - New - AzureAvailabilitySet - - - - The New-AzureRmAvailabilitySet cmdlet creates an Azure availability set. - - - - New-AzureRmAvailabilitySet - - ResourceGroupName - - Specifies the name of a resource group. - - String - - - Name - - Specifies a name for the availability set. - - String - - - Location - - Specifies the location for the availability set. - - String - - - PlatformUpdateDomainCount - - Specifies the platform update domain count. - - Nullable [System.Int32] - - - PlatformFaultDomainCount - - Specifies the platform fault domain count. - - Nullable [System.Int32] - - - Profile - - Specifies the Azure profile from which this cmdlet reads. If you do not specify a profile, this cmdlet reads from the local default profile. - - AzureProfile - - - - - - Location - - Specifies the location for the availability set. - - String - - String - - - none - - - Name - - Specifies a name for the availability set. - - String - - String - - - none - - - PlatformFaultDomainCount - - Specifies the platform fault domain count. - - Nullable [System.Int32] - - Nullable [System.Int32] - - - none - - - PlatformUpdateDomainCount - - Specifies the platform update domain count. - - Nullable [System.Int32] - - Nullable [System.Int32] - - - none - - - Profile - - Specifies the Azure profile from which this cmdlet reads. If you do not specify a profile, this cmdlet reads from the local default profile. - - AzureProfile - - AzureProfile - - - none - - - ResourceGroupName - - Specifies the name of a resource group. - - String - - String - - - none - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Example 1: Create an availability set - - - - - PS C:\>New-AzureRmAvailabilitySet -ResourceGroupName "ResourceGroup11" -Name "AvailabilitySet03" -Location "West US" - - - This command creates an availability set named AvailablitySet03 in the resource group named ResourceGroup11. - - - - - - - - - - - - - Get-AzureRmAvailabilitySet - - - - Remove-AzureRmAvailabilitySet - - - - - - Keywords: azure, azurerm, arm, resource, management, manager, compute, vm, iaas - - - - - - New-AzureRmVMConfig - - Creates a configurable virtual machine object. - - - - - New - AzureVMConfig - - - - The New-AzureRmVMConfig cmdlet creates a configurable local virtual machine object for Azure. Configure a virtual machine object by using other cmdlets, such as Set-AzureRmVMOperatingSystem, Set-AzureRmVMSourceImage, Add-AzureRmVMNetworkInterface, and Set-AzureRmVMOSDisk. - - - - New-AzureRmVMConfig - - VMName - - Specifies a name for the virtual machine. - - String - - - VMSize - - Specifies the size for the virtual machine. - - String - - - AvailabilitySetId - - Specifies the ID of an availability set. To obtain an availability set object, use the Get-AzureRmAvailabilitySet cmdlet. The availability set object contains an ID property. - - String - - - Profile - - Specifies the Azure profile from which this cmdlet reads. If you do not specify a profile, this cmdlet reads from the local default profile. - - AzureProfile - - - - - - AvailabilitySetId - - Specifies the ID of an availability set. To obtain an availability set object, use the Get-AzureRmAvailabilitySet cmdlet. The availability set object contains an ID property. - - String - - String - - - none - - - Profile - - Specifies the Azure profile from which this cmdlet reads. If you do not specify a profile, this cmdlet reads from the local default profile. - - AzureProfile - - AzureProfile - - - none - - - VMName - - Specifies a name for the virtual machine. - - String - - String - - - none - - - VMSize - - Specifies the size for the virtual machine. - - String - - String - - - none - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Example 1: Create a virtual machine object - - - - - PS C:\>$AvailabilitySet = Get-AzureRmAvailabilitySet -ResourceGroupName "ResourceGroup11" -Name "AvailabilitySet03" -PS C:\> $VirtualMachine = New-AzureRmVMConfig -VMName "VirtualMachine07" -VMSize "Standard_A1" -AvailabilitySetID $AvailabilitySet.Id - - - The first command gets the availability set named AvailablitySet03 in the resource group named ResourceGroup11, and then stores that object in the $AvailabilitySet variable. - The second command creates a virtual machine object, and then stores it in the $VirtualMachine variable. The command assigns a name and size to the virtual machine. The virtual machine belongs to the availability set stored in $AvailabilitySet. - - - - - - - - - - - - - Update-AzureRmVM - - - - Set-AzureRmVMOperatingSystem - - - - Set-AzureRmVMSourceImage - - - - Get-AzureRmAvailabilitySet - - - - - - Keywords: azure, azurerm, arm, resource, management, manager, compute, vm, iaas - - - - - - New-AzureRmVM - - Creates a virtual machine. - - - - - New - AzureVM - - - - The New-AzureRmVM cmdlet creates a virtual machine in Azure. This cmdlet takes a virtual machine object as input. Use the New-AzureRmVMConfig cmdlet to create a virtual machine object. Configure the virtual machine object by using other cmdlets, such as Set-AzureRmVMOperatingSystem, Set-AzureRmVMSourceImage, Add-AzureRmVMNetworkInterface, and Set-AzureRmVMOSDisk. - - - - New-AzureRmVM - - Name - - Specifies a name for the virtual machine. - - String - - - Profile - - Specifies the Azure profile from which this cmdlet reads. If you do not specify a profile, this cmdlet reads from the local default profile. - - AzureProfile - - - Tags - - - - - System.Collections.Hashtable[] - - - Location - - Specifies a location for the virtual machine. - - String - - - ResourceGroupName - - Specifies the name of a resource group. - - String - - - VM - - Specifies a local virtual machine to create. To obtain a virtual machine object, use the New-AzureRmVMConfig cmdlet. Configure the virtual machine by using other cmdlets, such as Set-AzureRmVMOperatingSystem, Set-AzureRmVMSourceImage, and Add-AzureRmVMNetworkInterface. - - PSVirtualMachine - - - - - - Location - - Specifies a location for the virtual machine. - - String - - String - - - none - - - Name - - Specifies a name for the virtual machine. - - String - - String - - - none - - - Profile - - Specifies the Azure profile from which this cmdlet reads. If you do not specify a profile, this cmdlet reads from the local default profile. - - AzureProfile - - AzureProfile - - - none - - - ResourceGroupName - - Specifies the name of a resource group. - - String - - String - - - none - - - Tags - - - - - System.Collections.Hashtable[] - - System.Collections.Hashtable[] - - - none - - - VM - - Specifies a local virtual machine to create. To obtain a virtual machine object, use the New-AzureRmVMConfig cmdlet. Configure the virtual machine by using other cmdlets, such as Set-AzureRmVMOperatingSystem, Set-AzureRmVMSourceImage, and Add-AzureRmVMNetworkInterface. - - PSVirtualMachine - - PSVirtualMachine - - - none - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Example 1: Create a virtual machine - - - - - PS C:\># Variables +PS C:\> $VirtualMachine = Set-AzureRmVMOperatingSystem -VM $VirtualMachine -Windows -ComputerName "Contoso26" -Credential $Credential +PS C:\> $SourceVaultId = "/subscriptions/46f8cea4-2de6-4179-8ab1-365da4211af4/resourceGroups/vault/providers/Microsoft.KeyVault/vaults/keyvault" +PS C:\> $CertificateStore01 = "My" +PS C:\> $CertificateUrl01 = "https://contosovault.vault.azure.net/secrets/514ceb769c984379a7e0230bdd703272" +PS C:\> $VirtualMachine = Add-AzureRmVMSecret -VM $VirtualMachine -SourceVaultId $SourceVaultId -CertificateStore $CertificateStore01 -CertificateUrl $CertificateUrl01 + + The first command creates a virtual machine object, and then stores it in the $VirtualMachine variable. The command assigns a name and size to the virtual machine. + + + The fifth command assigns a source vault ID to the $SourceVaultId variable for later use. The command assumes that the $SubscriptionId variable has an appropriate value. + + + + + + + + + + + + + + + + + Add-AzureRmVMSshPublicKey + + Adds the public keys for SSH for a virtual machine. + + + + + Add + AzureRmVMSshPublicKey + + + + The Add-AzureRmVMSshPublicKey cmdlet adds the public keys that you can use to connect to a virtual machine over Secure Shell (SSH). + + + + Add-AzureRmVMSshPublicKey + + VM + + Specifies the virtual machine object that this cmdlet modifies. To obtain a virtual machine object, use the Get-AzureRmVM cmdlet. Create a virtual machine object by using the New-AzureRmVMConfig cmdlet. + + PSVirtualMachine + + + KeyData + + Specifies a base 64 encoding of a public key. You can connect to a virtual machine by using SSH by using the key that this parameter specifies. + + String + + + Path + + Specifies the full path of a file, on the virtual machine, where this cmdlet stores the SSH public key. If the file already exists, this cmdlet appends the key to the file. + + String + + + InformationAction + + + + ActionPreference + + + InformationVariable + + + + String + + + + + + VM + + Specifies the virtual machine object that this cmdlet modifies. To obtain a virtual machine object, use the Get-AzureRmVM cmdlet. Create a virtual machine object by using the New-AzureRmVMConfig cmdlet. + + PSVirtualMachine + + PSVirtualMachine + + + none + + + KeyData + + Specifies a base 64 encoding of a public key. You can connect to a virtual machine by using SSH by using the key that this parameter specifies. + + String + + String + + + none + + + Path + + Specifies the full path of a file, on the virtual machine, where this cmdlet stores the SSH public key. If the file already exists, this cmdlet appends the key to the file. + + String + + String + + + none + + + InformationAction + + + + ActionPreference + + ActionPreference + + + + + + InformationVariable + + + + String + + String + + + + + + Profile + + Specifies the Azure profile from which this cmdlet reads. If you do not specify a profile, this cmdlet reads from the local default profile. + + azureprofile + + azureprofile + + + none + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Keywords: azure, azurerm, arm, resource, management, manager, compute, vm, iaas + + + + + -------------------------- Example 1: Add a public key to a virtual machine -------------------------- + + PS C:\> + + PS C:\>$VirtualMachine = Get-AzureRmVM -ResourceGroupName "ResourceGroup11" -Name "VirtualMachine07" +PS C:\> $VirtualMachine = Add-AzureRmVMSshPublicKey -VM $VirtualMachine -KeyData "MIIDszCCApugAwIBAgIJALBV9YJCF/tAMA0GCSq12Ib3DQEB21QUAMEUxCzAJBgNV" -Path "/home/admin/.ssh/authorized_keys" + + The first command gets the virtual machine named VirtualMachine07 by using the Get-AzureRmVM cmdlet. The command stores the virtual machine in the $VirtualMachine variable. + + + + + + + + + + + + + + + + Get-AzureRmVM + + + + + + + + Get-AzureRmAvailabilitySet + + Gets Azure availability sets in a resource group. + + + + + Get + AzureRmAvailabilitySet + + + + The Get-AzureRmAvailabilitySet cmdlet gets Azure availability sets in a resource group. Specify the name of a specific availability set to get. + + + + Get-AzureRmAvailabilitySet + + ResourceGroupName + + Specifies the name of a resource group. + + String + + + Name + + Specifies the name of an availability set to get. + + String + + + InformationAction + + + + ActionPreference + + + InformationVariable + + + + String + + + + + + ResourceGroupName + + Specifies the name of a resource group. + + String + + String + + + none + + + Name + + Specifies the name of an availability set to get. + + String + + String + + + none + + + InformationAction + + + + ActionPreference + + ActionPreference + + + + + + InformationVariable + + + + String + + String + + + + + + Profile + + Specifies the Azure profile from which this cmdlet reads. If you do not specify a profile, this cmdlet reads from the local default profile. + + azureprofile + + azureprofile + + + none + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Keywords: azure, azurerm, arm, resource, management, manager, compute, vm, iaas + + + + + -------------------------- Example 1: Get a specific availability set -------------------------- + + PS C:\> + + PS C:\>Get-AzureRmAvailabilitySet -ResourceGroupName "ResourceGroup11" -Name "AvailabilitySet03" + + This command gets the availability set named AvailablitySet03 in the resource group named ResourceGroup11. + + + + + + + + + + + + + + -------------------------- Example 2: Get all availability sets -------------------------- + + PS C:\> + + PS C:\>Get-AzureRmAvailabilitySet -ResourceGroupName "ResourceGroup11" + + This command gets all the availability sets in the resource group named ResourceGroup11. + + + + + + + + + + + + + + + + New-AzureRmAvailabilitySet + + + + Remove-AzureRmAvailabilitySet + + + + + + + + Get-AzureRmRemoteDesktopFile + + Gets an .rdp file. + + + + + Get + AzureRmRemoteDesktopFile + + + + The Get-AzureRmRemoteDesktopFile cmdlet gets a Remote Desktop Protocol (.rdp) file. + + + + Get-AzureRmRemoteDesktopFile + + ResourceGroupName + + Specifies the name of a resource group. + + String + + + Name + + Specifies the name of the availability set that this cmdlet gets. + + String + + + LocalPath + + Specifies the local full path where this cmdlet stores the .rdp file. + + String + + + InformationAction + + + + ActionPreference + + + InformationVariable + + + + String + + + + Get-AzureRmRemoteDesktopFile + + ResourceGroupName + + Specifies the name of a resource group. + + String + + + Name + + Specifies the name of the availability set that this cmdlet gets. + + String + + + LocalPath + + Specifies the local full path where this cmdlet stores the .rdp file. + + String + + + Launch + + + + SwitchParameter + + + InformationAction + + + + ActionPreference + + + InformationVariable + + + + String + + + + + + ResourceGroupName + + Specifies the name of a resource group. + + String + + String + + + none + + + Name + + Specifies the name of the availability set that this cmdlet gets. + + String + + String + + + none + + + LocalPath + + Specifies the local full path where this cmdlet stores the .rdp file. + + String + + String + + + none + + + InformationAction + + + + ActionPreference + + ActionPreference + + + + + + InformationVariable + + + + String + + String + + + + + + Launch + + + + SwitchParameter + + SwitchParameter + + + + + + Profile + + Specifies the Azure profile from which this cmdlet reads. If you do not specify a profile, this cmdlet reads from the local default profile. + + azureprofile + + azureprofile + + + none + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Keywords: azure, azurerm, arm, resource, management, manager, compute, vm, iaas + + + + + -------------------------- Example 1: Get a Remote Desktop file -------------------------- + + PS C:\> + + PS C:\>Get-AzureRmRemoteDesktopFile -ResourceGroupName "ResourceGroup11" -Name "VirtualMachine07" -LocalPath "D:\RemoteDesktopFile07.rdp" + + This command gets the Remote Desktop file for the virtual machine named VirtualMachine07. The command stores the result in the file named D:\RemoteDesktopFile07.rdp. + + + + + + + + + + + + + + + + + + + + Get-AzureRmVM + + Gets the properties of a virtual machine. + + + + + Get + AzureRmVM + + + + The Get-AzureRmVM cmdlet gets the model view and instance view of an Azure virtual machine. The model view is the user specified properties of the virtual machine. The instance view is the instance level status of the virtual machine. To get only the instance view of a virtual machine, specify the Status parameter. + + + + Get-AzureRmVM + + InformationAction + + + + ActionPreference + + + InformationVariable + + + + String + + + + Get-AzureRmVM + + ResourceGroupName + + Specifies the name of a resource group. + + String + + + Name + + Specifies the name of the virtual machine to get. + + String + + + Status + + Indicates that this cmdlet gets only the instance view of the virtual machine. + + SwitchParameter + + + InformationAction + + + + ActionPreference + + + InformationVariable + + + + String + + + + Get-AzureRmVM + + ResourceGroupName + + Specifies the name of a resource group. + + String + + + InformationAction + + + + ActionPreference + + + InformationVariable + + + + String + + + + Get-AzureRmVM + + NextLink + + Specifies the next link. + + Uri + + + InformationAction + + + + ActionPreference + + + InformationVariable + + + + String + + + + + + InformationAction + + + + ActionPreference + + ActionPreference + + + + + + InformationVariable + + + + String + + String + + + + + + ResourceGroupName + + Specifies the name of a resource group. + + String + + String + + + none + + + Name + + Specifies the name of the virtual machine to get. + + String + + String + + + none + + + Status + + Indicates that this cmdlet gets only the instance view of the virtual machine. + + SwitchParameter + + SwitchParameter + + + none + + + NextLink + + Specifies the next link. + + Uri + + Uri + + + none + + + Profile + + Specifies the Azure profile from which this cmdlet reads. If you do not specify a profile, this cmdlet reads from the local default profile. + + microsoft.azure.common.authentication.models.azureprofile + + microsoft.azure.common.authentication.models.azureprofile + + + none + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Keywords: azure, azurerm, arm, resource, management, manager, compute, vm, iaas + + + + + -------------------------- Example 1: Get model and instance view properties -------------------------- + + PS C:\> + + PS C:\>Get-AzureRmVM -ResourceGroupName "ResourceGroup11" -Name "VirtualMachine07" + + This command gets the model view and instance view properties of the virtual machine named VirtualMachine07. + + + + + + + + + + + + + + -------------------------- Example 2: Get instance view properties -------------------------- + + PS C:\> + + PS C:\>Get-AzureRmVM -ResourceGroupName "ResourceGroup11" -Name "VirtualMachine07" -Status + + This command gets properties of the virtual machine named VirtualMachine07. This command specifies the Status parameter. Therefore, the command gets only the instance view properties. + + + + + + + + + + + + + + -------------------------- Example 3: Get properties for all virtual machines in a resource group -------------------------- + + PS C:\> + + PS C:\> Get-AzureRmVM -ResourceGroupName "ResourceGroup11" + + This command gets properties for all the virtual machines in the resource group named ResourceGroup11. + + + + + + + + + + + + + + -------------------------- Example 4: Get all virtual machines in your subscription -------------------------- + + PS C:\> + + PS C:\>Get-AzureRmVM + + This command gets all the virtual machines in your subscription. + + + + + + + + + + + + + + + + New-AzureRmVM + + + + Remove-AzureRmVM + + + + Restart-AzureRmVM + + + + Start-AzureRmVM + + + + Stop-AzureRmVM + + + + Update-AzureRmVM + + + + + + + + Get-AzureRmVMAccessExtension + + Gets information about the VMAccess extension. + + + + + Get + AzureRmVMAccessExtension + + + + The Get-AzureRmVMAccessExtension cmdlet gets information about the Virtual Machine Access (VMAccess) Virtual Machine Extension. + + + + Get-AzureRmVMAccessExtension + + ResourceGroupName + + Specifies the name of the resource group of the virtual machine. + + String + + + VMName + + Specifies the name of a virtual machine. This cmdlet gets information about VMAccess for the virtual machine that this parameter specifies. + + String + + + Name + + Specifies the name of the extension that this cmdlet gets. + + String + + + Status + + Indicates that this cmdlet gets only the instance view of the extension. + + SwitchParameter + + + InformationAction + + + + ActionPreference + + + InformationVariable + + + + String + + + + + + ResourceGroupName + + Specifies the name of the resource group of the virtual machine. + + String + + String + + + none + + + VMName + + Specifies the name of a virtual machine. This cmdlet gets information about VMAccess for the virtual machine that this parameter specifies. + + String + + String + + + none + + + Name + + Specifies the name of the extension that this cmdlet gets. + + String + + String + + + none + + + Status + + Indicates that this cmdlet gets only the instance view of the extension. + + SwitchParameter + + SwitchParameter + + + none + + + InformationAction + + + + ActionPreference + + ActionPreference + + + + + + InformationVariable + + + + String + + String + + + + + + Profile + + Specifies the Azure profile from which this cmdlet reads. If you do not specify a profile, this cmdlet reads from the local default profile. + + azureprofile + + azureprofile + + + none + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Keywords: azure, azurerm, arm, resource, management, manager, compute, vm, iaas + + + + + -------------------------- Example 1: Get the VMAccess extension -------------------------- + + PS C:\> + + PS C:\>$VMAccessExtension = Get-AzureRmVMAccessExtension -ResourceGroupName "ResourceGroup11" -VMName "VirtualMachine07" -Name "ContosoTest" + + This command gets the VMAccess extension named ContosoTest for the virtual machine named VirtualMachine07. + + + + + + + + + + + + + + -------------------------- Example 2: Get the instance view of the VMAccess extension -------------------------- + + PS C:\> + + PS C:\>$VMAccessExtension = Get-AzureRmVMAccessExtension -ResourceGroupName "ResourceGroup11" -VMName "VirtualMachine0" -Name "ContosoTest" -Status + + This command gets the instance view of the VMAccess extension named ContosoTest for the virtual machine named VirtualMachine07. + + + + + + + + + + + + + + + + Remove-AzureRmVMAccessExtension + + + + Set-AzureRmVMAccessExtension + + + + Get-AzureRmVMExtension + + + + + + + + Get-AzureRmVMBootDiagnosticsData + + + + + + + Get + AzureRmVMBootDiagnosticsData + + + + + + + + Get-AzureRmVMBootDiagnosticsData + + ResourceGroupName + + + + String + + + Name + + + + String + + + Windows + + + + SwitchParameter + + + LocalPath + + + + String + + + InformationAction + + + + ActionPreference + + + InformationVariable + + + + String + + + + Get-AzureRmVMBootDiagnosticsData + + ResourceGroupName + + + + String + + + Name + + + + String + + + Linux + + + + SwitchParameter + + + LocalPath + + + + String + + + InformationAction + + + + ActionPreference + + + InformationVariable + + + + String + + + + + + ResourceGroupName + + + + String + + String + + + + + + Name + + + + String + + String + + + + + + Windows + + + + SwitchParameter + + SwitchParameter + + + + + + LocalPath + + + + String + + String + + + + + + InformationAction + + + + ActionPreference + + ActionPreference + + + + + + InformationVariable + + + + String + + String + + + + + + Linux + + + + SwitchParameter + + SwitchParameter + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Get-AzureRmVMCustomScriptExtension + + Gets information about a custom script extension. + + + + + Get + AzureRmVMCustomScriptExtension + + + + The Get-AzureRmVMCustomScriptExtension cmdlet gets information about a custom script Virtual Machine Extension on a virtual machine. + + + + Get-AzureRmVMCustomScriptExtension + + ResourceGroupName + + Specifies the name of the resource group of the virtual machine. + + String + + + VMName + + Specifies the name of a virtual machine for which this cmdlet gets the custom script extension. + + String + + + Name + + Specifies the name of the custom script extension about which this cmdlet gets information. + + String + + + Status + + Indicates that this cmdlet gets the instance view of the custom script extension. + + SwitchParameter + + + InformationAction + + + + ActionPreference + + + InformationVariable + + + + String + + + + + + ResourceGroupName + + Specifies the name of the resource group of the virtual machine. + + String + + String + + + none + + + VMName + + Specifies the name of a virtual machine for which this cmdlet gets the custom script extension. + + String + + String + + + none + + + Name + + Specifies the name of the custom script extension about which this cmdlet gets information. + + String + + String + + + none + + + Status + + Indicates that this cmdlet gets the instance view of the custom script extension. + + SwitchParameter + + SwitchParameter + + + none + + + InformationAction + + + + ActionPreference + + ActionPreference + + + + + + InformationVariable + + + + String + + String + + + + + + Profile + + Specifies the Azure profile from which this cmdlet reads. If you do not specify a profile, this cmdlet reads from the local default profile. + + azureprofile + + azureprofile + + + none + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Keywords: azure, azurerm, arm, resource, management, manager, compute, vm, iaas + + + + + -------------------------- Example 1: Get a custom script extension -------------------------- + + PS C:\> + + PS C:\>$VMCustomScriptExtension = Get-AzureRmVMCustomScriptExtension -ResourceGroupName "ResourceGroup11" -VMName "VirtualMachine07" -Name "ContosoCustomScript" + + This command gets the custom script extension named ContosoCustomScript for the virtual machine named VirtualMachine07. + + + + + + + + + + + + + + -------------------------- Example 2: Get the instance view of a custom script extension -------------------------- + + PS C:\> + + PS C:\>$VMCustomScriptExtension = Get-AzureRmVMCustomScriptExtension -ResourceGroupName "ResourceGroup11" -VMName "VirtualMachine07" -Name "ContosoCustomScript" -Status + + This command gets the instance view of the custom script extension named ContosoCustomScript for the virtual machine named VirtualMachine07. + + + + + + + + + + + + + + + + Get-AzureRmVMExtension + + + + Get-AzureRmVMExtensionImage + + + + Get-AzureRmVMAccessExtension + + + + + + + + Get-AzureRmVMDiagnosticsExtension + + + + + + + Get + AzureRmVMDiagnosticsExtension + + + + + + + + Get-AzureRmVMDiagnosticsExtension + + ResourceGroupName + + + + String + + + VMName + + + + String + + + Name + + + + String + + + Status + + + + SwitchParameter + + + InformationAction + + + + ActionPreference + + + InformationVariable + + + + String + + + + + + ResourceGroupName + + + + String + + String + + + + + + VMName + + + + String + + String + + + + + + Name + + + + String + + String + + + + + + Status + + + + SwitchParameter + + SwitchParameter + + + + + + InformationAction + + + + ActionPreference + + ActionPreference + + + + + + InformationVariable + + + + String + + String + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Get-AzureRmVMDiskEncryptionStatus + + Get-AzureRmVMDiskEncryptionStatus cmdlet displays the encryption status of the VM. It displays encryption status of the OS and Data volumes. In addition to encryption status, it also displays the secret URL and resource ID of the KeyVault where the encryption key for OS volume is present. + + + + + Get + AzureRmVMDiskEncryptionStatus + + + + + + + + Get-AzureRmVMDiskEncryptionStatus + + ResourceGroupName + + Resource group name of the virtual machine + + String + + + VMName + + Name of the virtual machine + + String + + + InformationAction + + + + ActionPreference + + + InformationVariable + + + + String + + + + + + ResourceGroupName + + Resource group name of the virtual machine + + String + + String + + + + + + VMName + + Name of the virtual machine + + String + + String + + + + + + InformationAction + + + + ActionPreference + + ActionPreference + + + + + + InformationVariable + + + + String + + String + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + -------------------------- Example 1 -------------------------- + + PS C:\> + + $rgName = 'MyResourceGroup'; +$vmName = 'MyWindowsVM'; +Get-AzureRmVmDiskEncryptionStatus -ResourceGroupName $rgname -VMName $vmName; + + + + + + + + + + + + + + + + + + + + + + Get-AzureRmVMDscExtension + + Gets the settings of the DSC extension on a particular VM + + + + + Get + AzureRmVMDscExtension + + + + Gets the settings of the DSC extension on a particular VM. + + + + Get-AzureRmVMDscExtension + + ResourceGroupName + + The resource group name. + + String + + + VMName + + The virtual machine name + + String + + + Name + + Name of the ARM resource that represents the extension. The Set-AzureRmVMDscExtension cmdlet sets this name to 'Microsoft.Powershell.DSC', which is the same value used by Get-AzureRmVMDscExtension. Specify this parameter only if you changed the default name in the Set cmdlet or used a different resource name in an ARM template. + + String + + + Status + + Output shows status when the switch is present + + SwitchParameter + + + InformationAction + + + + ActionPreference + + + InformationVariable + + + + String + + + + + + ResourceGroupName + + The resource group name. + + String + + String + + + + + + VMName + + The virtual machine name + + String + + String + + + + + + Name + + Name of the ARM resource that represents the extension. The Set-AzureRmVMDscExtension cmdlet sets this name to 'Microsoft.Powershell.DSC', which is the same value used by Get-AzureRmVMDscExtension. Specify this parameter only if you changed the default name in the Set cmdlet or used a different resource name in an ARM template. + + String + + String + + + + + + Status + + Output shows status when the switch is present + + SwitchParameter + + SwitchParameter + + + + + + InformationAction + + + + ActionPreference + + ActionPreference + + + + + + InformationVariable + + + + String + + String + + + + + + + + + + + + + + + + + + + + + + Microsoft.Azure.Commands.Compute.Extension.DSC.VirtualMachineDscExtensionContext + + + + + + + + + + + + + + + Keywords: azure, azurerm, arm, resource, management, manager, compute, vm, iaas + + + + + -------------------------- EXAMPLE 1 -------------------------- + + PS C:\> + + Get-AzureRmVMDscExtension -ResourceGroupName Name -VMName VM -Name 'DSC' + + Description + + + + + + + + + + + + + + + + Unknown + + + + + + + + Get-AzureRmVMDscExtensionStatus + + Used to get the status of the DSC extension handler for a VM in a resource group. When a configuration is applied this cmdlet produces output consistent with Start-DscConfiguration. + + + + + Get + AzureRmVMDscExtensionStatus + + + + + + + + Get-AzureRmVMDscExtensionStatus + + ResourceGroupName + + The resource group name. + + String + + + VMName + + The virtual machine name + + String + + + Name + + Name of the ARM resource that represents the extension. The Set-AzureRmVMDscExtension cmdlet sets this name to 'Microsoft.Powershell.DSC', which is the same value used by Get-AzureRmVMDscExtensionStatus. Specify this parameter only if you changed the default name in the Set cmdlet or used a different resource name in an ARM template. + + String + + + InformationAction + + + + ActionPreference + + + InformationVariable + + + + String + + + + + + ResourceGroupName + + The resource group name. + + String + + String + + + + + + VMName + + The virtual machine name + + String + + String + + + + + + Name + + Name of the ARM resource that represents the extension. The Set-AzureRmVMDscExtension cmdlet sets this name to 'Microsoft.Powershell.DSC', which is the same value used by Get-AzureRmVMDscExtensionStatus. Specify this parameter only if you changed the default name in the Set cmdlet or used a different resource name in an ARM template. + + String + + String + + + + + + InformationAction + + + + ActionPreference + + ActionPreference + + + + + + InformationVariable + + + + String + + String + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Keywords: azure, azurerm, arm, resource, management, manager, compute, vm, iaas + + + + + + + Unknown + + + + + + + + Get-AzureRmVMExtension + + Gets properties of Virtual Machine Extensions installed on a virtual machine. + + + + + Get + AzureRmVMExtension + + + + The Get-AzureRmVMExtension cmdlet gets properties of Virtual Machine Extensions installed on a virtual machine. Specify the name of an extension for which to get properties. To get only the instance view of an extension, specify the Status parameter. + + + + Get-AzureRmVMExtension + + ResourceGroupName + + Specifies the name of a resource group. + + String + + + VMName + + Specifies the name of a virtual machine. This cmdlet gets properties of an extension from the virtual machine that this parameter specifies. + + String + + + Name + + Specifies the name of an extension. This cmdlet gets properties for the extension that this parameter specifies. + + String + + + Status + + Indicates that this cmdlet gets only the instance view of an extension. + + SwitchParameter + + + InformationAction + + + + ActionPreference + + + InformationVariable + + + + String + + + + + + ResourceGroupName + + Specifies the name of a resource group. + + String + + String + + + none + + + VMName + + Specifies the name of a virtual machine. This cmdlet gets properties of an extension from the virtual machine that this parameter specifies. + + String + + String + + + none + + + Name + + Specifies the name of an extension. This cmdlet gets properties for the extension that this parameter specifies. + + String + + String + + + none + + + Status + + Indicates that this cmdlet gets only the instance view of an extension. + + SwitchParameter + + SwitchParameter + + + none + + + InformationAction + + + + ActionPreference + + ActionPreference + + + + + + InformationVariable + + + + String + + String + + + + + + Profile + + Specifies the Azure profile from which this cmdlet reads. If you do not specify a profile, this cmdlet reads from the local default profile. + + azureprofile + + azureprofile + + + none + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Keywords: azure, azurerm, arm, resource, management, manager, compute, vm, iaas + + + + + -------------------------- Example 1: Get properties of an extension -------------------------- + + PS C:\> + + PS C:\>Get-AzureRmVMExtension -ResourceGroupName "ResourceGroup11" -VMName "VirtualMachine22" -Name "CustomScriptExtension" + + This command gets properties for the extension named CustomScriptExtension on the virtual machine named VirtualMachine22 in the resource group ResourceGroup11. + + + + + + + + + + + + + + -------------------------- Example 2: Get instance view of an extension -------------------------- + + PS C:\> + + PS C:\>Get-AzureRmVMExtension -ResourceGroupName "ResourceGroup11" -VMName "VirtualMachine22" -Name "CustomScriptExtension" -Status + + This command gets the instance view for the extension named CustomScriptExtension on the virtual machine named VirtualMachine22 in the resource group ResourceGroup11. + + + + + + + + + + + + + + + + Remove-AzureRmVMExtension + + + + Set-AzureRmVMExtension + + + + + + + + Get-AzureRmVmExtensionImage + + Gets all versions for an Azure extension. + + + + + Get + AzureRmVmExtensionImage + + + + The Get-AzureRmVMExtensionImage cmdlet gets all versions for an Azure extension. + + + + Get-AzureRmVmExtensionImage + + Location + + Specifies the location of an extension. + + String + + + PublisherName + + Specifies the name of an extension publisher. To obtain an extension publisher, use the Get-AzureRmVMImagePublisher cmdlet. + + String + + + Type + + Specifies the type of the extension. To obtain an extension type, use the Get-AzureRmVMExtensionImageType cmdlet. + + String + + + FilterExpression + + Specifies a filter expression. + + String + + + Version + + + + String + + + InformationAction + + + + ActionPreference + + + InformationVariable + + + + String + + + + + + Location + + Specifies the location of an extension. + + String + + String + + + none + + + PublisherName + + Specifies the name of an extension publisher. To obtain an extension publisher, use the Get-AzureRmVMImagePublisher cmdlet. + + String + + String + + + none + + + Type + + Specifies the type of the extension. To obtain an extension type, use the Get-AzureRmVMExtensionImageType cmdlet. + + String + + String + + + none + + + FilterExpression + + Specifies a filter expression. + + String + + String + + + none + + + Version + + + + String + + String + + + none + + + InformationAction + + + + ActionPreference + + ActionPreference + + + + + + InformationVariable + + + + String + + String + + + + + + Profile + + Specifies the Azure profile from which this cmdlet reads. If you do not specify a profile, this cmdlet reads from the local default profile. + + azureprofile + + azureprofile + + + none + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Keywords: azure, azurerm, arm, resource, management, manager, compute, vm, iaas + + + + + -------------------------- Example 1: Get the versions of an extension image -------------------------- + + PS C:\> + + PS C:\>Get-AzureRmVMExtensionImage -Location "Central US" -PublisherName "Fabrikam" -Type "FabrikamEndpointProtection" + + This command gets all the versions of the extension image for the specified location, publisher, and type. + + + + + + + + + + + + + + + + Get-AzureRmVMExtensionImageType + + + + Get-AzureRmVMImage + + + + Get-AzureRmVMImagePublisher + + + + Get-AzureRmVMExtensionImageType + + + + + + + + Get-AzureRmVMExtensionImageType + + Gets the type of an Azure extension. + + + + + Get + AzureRmVMExtensionImageType + + + + The Get-AzureRmVMExtensionImageType cmdlet gets the type of an Azure extension. + + + + Get-AzureRmVMExtensionImageType + + Location + + Specifies the location of an extension. This cmdlet gets the type for an extension at the location that this parameter specifies. + + String + + + PublisherName + + Specifies the name of a publisher of an extension. To obtain an extension publisher, use the Get-AzureRmVMImagePublisher cmdlet. This cmdlet gets the type for an extension from the publisher that this parameter specifies. + + String + + + InformationAction + + + + ActionPreference + + + InformationVariable + + + + String + + + + + + Location + + Specifies the location of an extension. This cmdlet gets the type for an extension at the location that this parameter specifies. + + String + + String + + + none + + + PublisherName + + Specifies the name of a publisher of an extension. To obtain an extension publisher, use the Get-AzureRmVMImagePublisher cmdlet. This cmdlet gets the type for an extension from the publisher that this parameter specifies. + + String + + String + + + none + + + InformationAction + + + + ActionPreference + + ActionPreference + + + + + + InformationVariable + + + + String + + String + + + + + + Profile + + Specifies the Azure profile from which this cmdlet reads. If you do not specify a profile, this cmdlet reads from the local default profile. + + azureprofile + + azureprofile + + + none + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Keywords: azure, azurerm, arm, resource, management, manager, compute, vm, iaas + + + + + -------------------------- Example 1: Get an extension image type -------------------------- + + PS C:\> + + PS C:\>Get-AzureRmVMExtensionImageType -Location "Central US" -PublisherName "Fabrikam" + + This command gets the extension image type for the specified publisher and location. + + + + + + + + + + + + + + + + Get-AzureRmVMExtensionImage + + + + + + + + Get-AzureRmVMImage + + Gets all the versions of a VMImage. + + + + + Get + AzureRmVMImage + + + + The Get-AzureRmVMImage cmdlet gets all the versions of a VMImage. + + + + Get-AzureRmVMImage + + Location + + Specifies the location of a VMImage. + + String + + + PublisherName + + Specifies the publisher of a VMImage. To obtain an image publisher, use the Get-AzureRmVMImagePublisher cmdlet. + + String + + + Offer + + Specifies the type of VMImage offer. To obtain an image offer, use the Get-AzureRmVMImageOffer cmdlet. + + String + + + Skus + + Specifies a VMImage SKU. To obtain an SKU, use the Get-AzureRmVMImageSku cmdlet. + + String + + + FilterExpression + + Specifies a filter expression. + + String + + + InformationAction + + + + ActionPreference + + + InformationVariable + + + + String + + + + Get-AzureRmVMImage + + Location + + Specifies the location of a VMImage. + + String + + + PublisherName + + Specifies the publisher of a VMImage. To obtain an image publisher, use the Get-AzureRmVMImagePublisher cmdlet. + + String + + + Offer + + Specifies the type of VMImage offer. To obtain an image offer, use the Get-AzureRmVMImageOffer cmdlet. + + String + + + Skus + + Specifies a VMImage SKU. To obtain an SKU, use the Get-AzureRmVMImageSku cmdlet. + + String + + + Version + + + + String + + + InformationAction + + + + ActionPreference + + + InformationVariable + + + + String + + + + + + Location + + Specifies the location of a VMImage. + + String + + String + + + none + + + PublisherName + + Specifies the publisher of a VMImage. To obtain an image publisher, use the Get-AzureRmVMImagePublisher cmdlet. + + String + + String + + + none + + + Offer + + Specifies the type of VMImage offer. To obtain an image offer, use the Get-AzureRmVMImageOffer cmdlet. + + String + + String + + + none + + + Skus + + Specifies a VMImage SKU. To obtain an SKU, use the Get-AzureRmVMImageSku cmdlet. + + String + + String + + + none + + + FilterExpression + + Specifies a filter expression. + + String + + String + + + none + + + InformationAction + + + + ActionPreference + + ActionPreference + + + + + + InformationVariable + + + + String + + String + + + + + + Version + + + + String + + String + + + none + + + Profile + + Specifies the Azure profile from which this cmdlet reads. If you do not specify a profile, this cmdlet reads from the local default profile. + + microsoft.azure.common.authentication.models.azureprofile + + microsoft.azure.common.authentication.models.azureprofile + + + none + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Keywords: azure, azurerm, arm, resource, management, manager, compute, vm, iaas + + + + + -------------------------- Example 1: Get VMImage objects -------------------------- + + PS C:\> + + PS C:\>Get-AzureRmVMImage -Location "Central US" -PublisherName "Canonical" -Offer "UbuntuServer" -Skus "15.04-DAILY" + + This command gets all the versions of VMImage that match the specified values. + + + + + + + + + + + + + + + + Get-AzureRmVMImageOffer + + + + Get-AzureRmVMImagePublisher + + + + Get-AzureRmVMImageSku + + + + Save-AzureRmVMImage + + + + + + + + Get-AzureRmVMImageOffer + + Gets VMImage offer types. + + + + + Get + AzureRmVMImageOffer + + + + The Get-AzureRmVMImageOffer cmdlet gets the VMImage offer types. + + + + Get-AzureRmVMImageOffer + + Location + + Specifies the location of the VMImage. + + String + + + PublisherName + + Specifies the name of a publisher of a VMImage. To obtain a publisher, use the Get-AzureRmVMImagePublisher cmdlet. + + String + + + InformationAction + + + + ActionPreference + + + InformationVariable + + + + String + + + + + + Location + + Specifies the location of the VMImage. + + String + + String + + + none + + + PublisherName + + Specifies the name of a publisher of a VMImage. To obtain a publisher, use the Get-AzureRmVMImagePublisher cmdlet. + + String + + String + + + none + + + InformationAction + + + + ActionPreference + + ActionPreference + + + + + + InformationVariable + + + + String + + String + + + + + + Profile + + Specifies the Azure profile from which this cmdlet reads. If you do not specify a profile, this cmdlet reads from the local default profile. + + azureprofile + + azureprofile + + + none + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Keywords: azure, azurerm, arm, resource, management, manager, compute, vm, iaas + + + + + -------------------------- Example 1: Get offer types for a publisher -------------------------- + + PS C:\> + + PS C:\>Get-AzureRmVMImageOffer -Location "Central US" -PublisherName "Fabrikam" + + This command gets the offer types for the specified publisher in the Central US region. + + + + + + + + + + + + + + + + Get-AzureRmVMImage + + + + Get-AzureRmVMImagePublisher + + + + Get-AzureRmVMImageSku + + + + Save-AzureRmVMImage + + + + + + + + Get-AzureRmVMImagePublisher + + Gets the VMImage publishers. + + + + + Get + AzureRmVMImagePublisher + + + + The Get-AzureRmVMImagePublisher cmdlet gets the VMImage publishers. + + + + Get-AzureRmVMImagePublisher + + Location + + Specifies the location of the VMImage. + + String + + + InformationAction + + + + ActionPreference + + + InformationVariable + + + + String + + + + + + Location + + Specifies the location of the VMImage. + + String + + String + + + none + + + InformationAction + + + + ActionPreference + + ActionPreference + + + + + + InformationVariable + + + + String + + String + + + + + + Profile + + Specifies the Azure profile from which this cmdlet reads. If you do not specify a profile, this cmdlet reads from the local default profile. + + azureprofile + + azureprofile + + + none + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Keywords: azure, azurerm, arm, resource, management, manager, compute, vm, iaas + + + + + -------------------------- Example 1: Get VMImage publishers for a region -------------------------- + + PS C:\> + + PS C:\>Get-AzureRmVMImagePublisher -Location "Central US" + + This command gets the publishers of VMImage instances for the Central US region within your profile. + + + + + + + + + + + + + + + + Get-AzureRmVMImage + + + + Get-AzureRmVMImageOffer + + + + Get-AzureRmVMImageSku + + + + Save-AzureRmVMImage + + + + + + + + Get-AzureRmVMImageSku + + Gets VMImage SKUs. + + + + + Get + AzureRmVMImageSku + + + + The Get-AzureRmVMImageSku cmdlet gets VMImage SKUs. + + + + Get-AzureRmVMImageSku + + Location + + Specifies the location of the VMImage. + + String + + + PublisherName + + Specifies the publisher of a VMImage. + + String + + + Offer + + Specifies the type of VMImage offer. + + String + + + InformationAction + + + + ActionPreference + + + InformationVariable + + + + String + + + + + + Location + + Specifies the location of the VMImage. + + String + + String + + + none + + + PublisherName + + Specifies the publisher of a VMImage. + + String + + String + + + none + + + Offer + + Specifies the type of VMImage offer. + + String + + String + + + none + + + InformationAction + + + + ActionPreference + + ActionPreference + + + + + + InformationVariable + + + + String + + String + + + + + + Profile + + Specifies the Azure profile from which this cmdlet reads. If you do not specify a profile, this cmdlet reads from the local default profile. + + azureprofile + + azureprofile + + + none + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Keywords: azure, azurerm, arm, resource, management, manager, compute, vm, iaas + + + + + -------------------------- Example 1: Get SKUs -------------------------- + + PS C:\> + + PS C:\>Get-AzureRmVMImageSku -Location "Central US" -PublisherName "Fabrikam" -Offer "LinuxServer" + + This command gets the SKUs for the specified publisher and offer. + + + + + + + + + + + + + + + + Get-AzureRmVMImage + + + + Get-AzureRmVMImageOffer + + + + Get-AzureRmVMImagePublisher + + + + Save-AzureRmVMImage + + + + + + + + Get-AzureRmVMSize + + Gets available virtual machine sizes. + + + + + Get + AzureRmVMSize + + + + The Get-AzureRmVMSize cmdlet gets available virtual machine sizes. + + + + Get-AzureRmVMSize + + Location + + Specifies the location for which this cmdlet gets the available virtual machine sizes. + + String + + + InformationAction + + + + ActionPreference + + + InformationVariable + + + + String + + + + Get-AzureRmVMSize + + ResourceGroupName + + Specifies the name of the resource group of the virtual machine. + + String + + + VMName + + Specifies the name of the virtual machine that this cmdlet gets the available virtual machine sizes for resizing. + + String + + + InformationAction + + + + ActionPreference + + + InformationVariable + + + + String + + + + Get-AzureRmVMSize + + ResourceGroupName + + Specifies the name of the resource group of the virtual machine. + + String + + + AvailabilitySetName + + Specifies the name of the Availability Set for which this cmdlet gets the available virtual machine sizes. + + String + + + InformationAction + + + + ActionPreference + + + InformationVariable + + + + String + + + + + + Location + + Specifies the location for which this cmdlet gets the available virtual machine sizes. + + String + + String + + + none + + + InformationAction + + + + ActionPreference + + ActionPreference + + + + + + InformationVariable + + + + String + + String + + + + + + ResourceGroupName + + Specifies the name of the resource group of the virtual machine. + + String + + String + + + none + + + VMName + + Specifies the name of the virtual machine that this cmdlet gets the available virtual machine sizes for resizing. + + String + + String + + + none + + + AvailabilitySetName + + Specifies the name of the Availability Set for which this cmdlet gets the available virtual machine sizes. + + String + + String + + + none + + + Profile + + Specifies the Azure profile from which this cmdlet reads. If you do not specify a profile, this cmdlet reads from the local default profile. + + azureprofile + + azureprofile + + + none + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Keywords: azure, azurerm, arm, resource, management, manager, compute, vm, iaas + + + + + -------------------------- Example 1: Get sizes for a location -------------------------- + + PS C:\> + + PS C:\>Get-AzureRmVMSize -Location "Central US" + + This command gets the available sizes for virtual machines in the specified location. + + + + + + + + + + + + + + -------------------------- Example 2: Get sizes for an availability set -------------------------- + + PS C:\> + + PS C:\>Get-AzureRmVMSize -ResourceGroupName "ResourceGroup03" -AvailabilitySetName "AvailabilitySet17" + + This command gets available sizes for virtual machines that you can deploy in the availability set named AvailabilitySet17. + + + + + + + + + + + + + + -------------------------- Example 3: Get sizes for an existing virtual machine -------------------------- + + PS C:\> + + PS C:\>Get-AzureRmVMSize -ResourceGroupName "ResourceGroup03" -VMName "VirtualMachine12" + + This command gets available sizes for the existing virtual machine named VirtualMachine12. You can resize this virtual machine to the sizes that this command gets. + + + + + + + + + + + + + + + + Get-AzureRmVM + + + + + + + + Get-AzureRmVMSqlServerExtension + + + + + + + Get + AzureRmVMSqlServerExtension + + + + + + + + Get-AzureRmVMSqlServerExtension + + ResourceGroupName + + + + String + + + VMName + + + + String + + + Name + + + + String + + + InformationAction + + + + ActionPreference + + + InformationVariable + + + + String + + + + + + ResourceGroupName + + + + String + + String + + + + + + VMName + + + + String + + String + + + + + + Name + + + + String + + String + + + + + + InformationAction + + + + ActionPreference + + ActionPreference + + + + + + InformationVariable + + + + String + + String + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Get-AzureRmVMUsage + + Gets the virtual machine core count usage for a location. + + + + + Get + AzureRmVMUsage + + + + The Get-AzureRmVMUsage cmdlet gets the virtual machine core count usage for a location. + + + + Get-AzureRmVMUsage + + Location + + Specifies the location for which this cmdlet gets virtual machine core count usage. + + String + + + InformationAction + + + + ActionPreference + + + InformationVariable + + + + String + + + + + + Location + + Specifies the location for which this cmdlet gets virtual machine core count usage. + + String + + String + + + none + + + InformationAction + + + + ActionPreference + + ActionPreference + + + + + + InformationVariable + + + + String + + String + + + + + + Profile + + Specifies the Azure profile from which this cmdlet reads. If you do not specify a profile, this cmdlet reads from the local default profile. + + azureprofile + + azureprofile + + + none + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Keywords: azure, azurerm, arm, resource, management, manager, compute, vm, iaas + + + + + -------------------------- Example 1: Get core count usage for a location -------------------------- + + PS C:\> + + PS C:\>Get-AzureRmVMUsage -Location "Central US" + + This command gets the virtual machine core count usage for the location Central US. + + + + + + + + + + + + + + + + + + + + New-AzureRmAvailabilitySet + + Creates an Azure availability set. + + + + + New + AzureRmAvailabilitySet + + + + The New-AzureRmAvailabilitySet cmdlet creates an Azure availability set. + + + + New-AzureRmAvailabilitySet + + ResourceGroupName + + Specifies the name of a resource group. + + String + + + Name + + Specifies a name for the availability set. + + String + + + Location + + Specifies the location for the availability set. + + String + + + PlatformUpdateDomainCount + + Specifies the platform update domain count. + + Nullable`1[Int32] + + + PlatformFaultDomainCount + + Specifies the platform fault domain count. + + Nullable`1[Int32] + + + InformationAction + + + + ActionPreference + + + InformationVariable + + + + String + + + + + + ResourceGroupName + + Specifies the name of a resource group. + + String + + String + + + none + + + Name + + Specifies a name for the availability set. + + String + + String + + + none + + + Location + + Specifies the location for the availability set. + + String + + String + + + none + + + PlatformUpdateDomainCount + + Specifies the platform update domain count. + + Nullable`1[Int32] + + Nullable`1[Int32] + + + none + + + PlatformFaultDomainCount + + Specifies the platform fault domain count. + + Nullable`1[Int32] + + Nullable`1[Int32] + + + none + + + InformationAction + + + + ActionPreference + + ActionPreference + + + + + + InformationVariable + + + + String + + String + + + + + + Profile + + Specifies the Azure profile from which this cmdlet reads. If you do not specify a profile, this cmdlet reads from the local default profile. + + azureprofile + + azureprofile + + + none + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Keywords: azure, azurerm, arm, resource, management, manager, compute, vm, iaas + + + + + -------------------------- Example 1: Create an availability set -------------------------- + + PS C:\> + + PS C:\>New-AzureRmAvailabilitySet -ResourceGroupName "ResourceGroup11" -Name "AvailabilitySet03" -Location "West US" + + This command creates an availability set named AvailablitySet03 in the resource group named ResourceGroup11. + + + + + + + + + + + + + + + + Get-AzureRmAvailabilitySet + + + + Remove-AzureRmAvailabilitySet + + + + + + + + New-AzureRmVM + + Creates a virtual machine. + + + + + New + AzureRmVM + + + + The New-AzureRmVM cmdlet creates a virtual machine in Azure. This cmdlet takes a virtual machine object as input. Use the New-AzureRmVMConfig cmdlet to create a virtual machine object. Configure the virtual machine object by using other cmdlets, such as Set-AzureRmVMOperatingSystem, Set-AzureRmVMSourceImage, Add-AzureRmVMNetworkInterface, and Set-AzureRmVMOSDisk. + + + + New-AzureRmVM + + ResourceGroupName + + Specifies the name of a resource group. + + String + + + Location + + Specifies a location for the virtual machine. + + String + + + VM + + Specifies a local virtual machine to create. To obtain a virtual machine object, use the New-AzureRmVMConfig cmdlet. Configure the virtual machine by using other cmdlets, such as Set-AzureRmVMOperatingSystem, Set-AzureRmVMSourceImage, and Add-AzureRmVMNetworkInterface. + + PSVirtualMachine + + + Tags + + + + Hashtable[] + + + InformationAction + + + + ActionPreference + + + InformationVariable + + + + String + + + + + + ResourceGroupName + + Specifies the name of a resource group. + + String + + String + + + none + + + Location + + Specifies a location for the virtual machine. + + String + + String + + + none + + + VM + + Specifies a local virtual machine to create. To obtain a virtual machine object, use the New-AzureRmVMConfig cmdlet. Configure the virtual machine by using other cmdlets, such as Set-AzureRmVMOperatingSystem, Set-AzureRmVMSourceImage, and Add-AzureRmVMNetworkInterface. + + PSVirtualMachine + + PSVirtualMachine + + + none + + + Tags + + + + Hashtable[] + + Hashtable[] + + + none + + + InformationAction + + + + ActionPreference + + ActionPreference + + + + + + InformationVariable + + + + String + + String + + + + + + Name + + Specifies a name for the virtual machine. + + string + + string + + + none + + + Profile + + Specifies the Azure profile from which this cmdlet reads. If you do not specify a profile, this cmdlet reads from the local default profile. + + azureprofile + + azureprofile + + + none + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Keywords: azure, azurerm, arm, resource, management, manager, compute, vm, iaas + + + + + -------------------------- Example 1: Create a virtual machine -------------------------- + + PS C:\> + + PS C:\># Variables ## Global -$ResourceGroupName = "ResourceGroup11" -$Location = "westeurope" +$ResourceGroupName = "ResourceGroup11" +$Location = "westeurope" ## Storage -$StorageName = "GeneralStorage6cc" -$StorageType = "Standard_GRS" +$StorageName = "GeneralStorage6cc" +$StorageType = "Standard_GRS" ## Network -$InterfaceName = "ServerInterface06" -$Subnet1Name = "Subnet1" -$VNetName = "VNet09" -$VNetAddressPrefix = "10.0.0.0/16" -$VNetSubnetAddressPrefix = "10.0.0.0/24" +$InterfaceName = "ServerInterface06" +$Subnet1Name = "Subnet1" +$VNetName = "VNet09" +$VNetAddressPrefix = "10.0.0.0/16" +$VNetSubnetAddressPrefix = "10.0.0.0/24" ## Compute -$VMName = "VirtualMachine12" -$ComputerName = "Server22" -$VMSize = "Standard_A2" -$OSDiskName = $VMName + "osDisk" +$VMName = "VirtualMachine12" +$ComputerName = "Server22" +$VMSize = "Standard_A2" +$OSDiskName = $VMName + "osDisk" # Resource Group New-AzureRmResourceGroup -Name $ResourceGroupName -Location $Location @@ -4867,6182 +6277,10835 @@ $Interface = New-AzureRmNetworkInterface -Name $InterfaceName -ResourceGroupName $Credential = Get-Credential $VirtualMachine = New-AzureRmVMConfig -VMName $VMName -VMSize $VMSize $VirtualMachine = Set-AzureRmVMOperatingSystem -VM $VirtualMachine -Windows -ComputerName $ComputerName -Credential $Credential -ProvisionVMAgent -EnableAutoUpdate -$VirtualMachine = Set-AzureRmVMSourceImage -VM $VirtualMachine -PublisherName MicrosoftWindowsServer -Offer WindowsServer -Skus 2012-R2-Datacenter -Version "latest" +$VirtualMachine = Set-AzureRmVMSourceImage -VM $VirtualMachine -PublisherName MicrosoftWindowsServer -Offer WindowsServer -Skus 2012-R2-Datacenter -Version "latest" $VirtualMachine = Add-AzureRmVMNetworkInterface -VM $VirtualMachine -Id $Interface.Id -$OSDiskUri = $StorageAccount.PrimaryEndpoints.Blob.ToString() + "vhds/" + $OSDiskName + ".vhd" +$OSDiskUri = $StorageAccount.PrimaryEndpoints.Blob.ToString() + "vhds/" + $OSDiskName + ".vhd" $VirtualMachine = Set-AzureRmVMOSDisk -VM $VirtualMachine -Name $OSDiskName -VhdUri $OSDiskUri -CreateOption FromImage ## Create the VM in Azure -New-AzureRmVM -ResourceGroupName $ResourceGroupName -Location $Location -VM $VirtualMachine +New-AzureRmVM -ResourceGroupName $ResourceGroupName -Location $Location -VM $VirtualMachine + + This example script shows how to create a virtual machine. This script uses several other cmdlets. + + + + + + + + + + + + + + + + Get-AzureRmVM + + + + Remove-AzureRmVM + + + + Restart-AzureRmVM + + + + Start-AzureRmVM + + + + Stop-AzureRmVM + + + + Update-AzureRmVM + + + + Add-AzureRmVMDataDisk + + + + Add-AzureRmVMNetworkInterface + + + + New-AzureRmVMConfig + + + + Set-AzureRmVMOperatingSystem + + + + Set-AzureRmVMSourceImage + + + + Set-AzureRmVMOSDisk + + + + + + + + New-AzureRmVMConfig + + Creates a configurable virtual machine object. + + + + + New + AzureRmVMConfig + + + + The New-AzureRmVMConfig cmdlet creates a configurable local virtual machine object for Azure. Configure a virtual machine object by using other cmdlets, such as Set-AzureRmVMOperatingSystem, Set-AzureRmVMSourceImage, Add-AzureRmVMNetworkInterface, and Set-AzureRmVMOSDisk. + + + + New-AzureRmVMConfig + + VMName + + Specifies a name for the virtual machine. + + String + + + VMSize + + Specifies the size for the virtual machine. + + String + + + AvailabilitySetId + + Specifies the ID of an availability set. To obtain an availability set object, use the Get-AzureRmAvailabilitySet cmdlet. The availability set object contains an ID property. + + String + + + InformationAction + + + + ActionPreference + + + InformationVariable + + + + String + + + + + + VMName + + Specifies a name for the virtual machine. + + String + + String + + + none + + + VMSize + + Specifies the size for the virtual machine. + + String + + String + + + none + + + AvailabilitySetId + + Specifies the ID of an availability set. To obtain an availability set object, use the Get-AzureRmAvailabilitySet cmdlet. The availability set object contains an ID property. + + String + + String + + + none + + + InformationAction + + + + ActionPreference + + ActionPreference + + + + + + InformationVariable + + + + String + + String + + + + + + Profile + + Specifies the Azure profile from which this cmdlet reads. If you do not specify a profile, this cmdlet reads from the local default profile. + + azureprofile + + azureprofile + + + none + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Keywords: azure, azurerm, arm, resource, management, manager, compute, vm, iaas + + + + + -------------------------- Example 1: Create a virtual machine object -------------------------- + + PS C:\> + + PS C:\>$AvailabilitySet = Get-AzureRmAvailabilitySet -ResourceGroupName "ResourceGroup11" -Name "AvailabilitySet03" +PS C:\> $VirtualMachine = New-AzureRmVMConfig -VMName "VirtualMachine07" -VMSize "Standard_A1" -AvailabilitySetID $AvailabilitySet.Id + + The first command gets the availability set named AvailablitySet03 in the resource group named ResourceGroup11, and then stores that object in the $AvailabilitySet variable. + + + + + + + + + + + + + + + + Update-AzureRmVM + + + + Set-AzureRmVMOperatingSystem + + + + Set-AzureRmVMSourceImage + + + + Get-AzureRmAvailabilitySet + + + + + + + + New-AzureVMSqlServerAutoBackupConfig + + + + + + + New + AzureVMSqlServerAutoBackupConfig + + + + + + + + New-AzureVMSqlServerAutoBackupConfig + + ResourceGroupName + + + + String + + + Enable + + + + SwitchParameter + + + RetentionPeriodInDays + + + + Int32 + + + EnableEncryption + + + + SwitchParameter + + + CertificatePassword + + + + SecureString + + + StorageUri + + + + Uri + + + StorageKey + + + + SecureString + + + InformationAction + + + + ActionPreference + + + InformationVariable + + + + String + + + + New-AzureVMSqlServerAutoBackupConfig + + ResourceGroupName + + + + String + + + Enable + + + + SwitchParameter + + + RetentionPeriodInDays + + + + Int32 + + + EnableEncryption + + + + SwitchParameter + + + CertificatePassword + + + + SecureString + + + StorageContext + + + + AzureStorageContext + + + StorageUri + + + + Uri + + + StorageKey + + + + SecureString + + + InformationAction + + + + ActionPreference + + + InformationVariable + + + + String + + + + + + ResourceGroupName + + + + String + + String + + + + + + Enable + + + + SwitchParameter + + SwitchParameter + + + + + + RetentionPeriodInDays + + + + Int32 + + Int32 + + + + + + EnableEncryption + + + + SwitchParameter + + SwitchParameter + + + + + + CertificatePassword + + + + SecureString + + SecureString + + + + + + StorageUri + + + + Uri + + Uri + + + + + + StorageKey + + + + SecureString + + SecureString + + + + + + InformationAction + + + + ActionPreference + + ActionPreference + + + + + + InformationVariable + + + + String + + String + + + + + + StorageContext + + + + AzureStorageContext + + AzureStorageContext + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + New-AzureVMSqlServerAutoPatchingConfig + + + + + + + New + AzureVMSqlServerAutoPatchingConfig + + + + + + + + New-AzureVMSqlServerAutoPatchingConfig + + Enable + + + + SwitchParameter + + + DayOfWeek + + + + String + + + MaintenanceWindowStartingHour + + + + Int32 + + + MaintenanceWindowDuration + + + + Int32 + + + PatchCategory + + + + String + + + InformationAction + + + + ActionPreference + + + InformationVariable + + + + String + + + + + + Enable + + + + SwitchParameter + + SwitchParameter + + + + + + DayOfWeek + + + + String + + String + + + + + + MaintenanceWindowStartingHour + + + + Int32 + + Int32 + + + + + + MaintenanceWindowDuration + + + + Int32 + + Int32 + + + + + + PatchCategory + + + + String + + String + + + + + + InformationAction + + + + ActionPreference + + ActionPreference + + + + + + InformationVariable + + + + String + + String + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Publish-AzureRmVMDscConfiguration + + Uploads a Desired State Configuration script to Azure blob storage, which later can be applied to Azure Virtual Machines using the Set-AzureRmVMDscExtension cmdlet. + + + + + Publish + AzureRmVMDscConfiguration + + + + Uploads a Desired State Configuration script to Azure blob storage, which later can be applied to Azure Virtual Machines using the Set-AzureRmVMDscExtension cmdlet. + + + + Publish-AzureRmVMDscConfiguration + + ResourceGroupName + + The name of the resource group that contains the storage account + + String + + + ConfigurationPath + + Path to a file containing one or more configurations. The file can be a PowerShell script (.ps1 file), module (.psm1 file). + + String + + + ContainerName + + Name of the Azure Storage Container the configuration is uploaded to. + + String + + + StorageAccountName + + The Azure Storage Account name used to upload the configuration script to the container specified by ContainerName + + String + + + StorageEndpointSuffix + + Suffix for the storage end point, e.g. core.windows.net + + String + + + Force + + By default Publish-AzureRmVMDscConfiguration will not overwrite any existing blobs or files. Use -Force to overwrite them. + + SwitchParameter + + + SkipDependencyDetection + + Excludes DSC resource dependencies from the configuration archive. + + SwitchParameter + + + ConfigurationDataPath + + Path to a .psd1 file that specifies the data for the Configuration. This is added to the configuration archive and then passed to the configuration function. It gets overwritten by the configuration data path provided through the Set-AzureRmVMDscExtension cmdlet + + String + + + AdditionalPath + + Path to a file or a directory to include in the configuration archive. It gets downloaded to the VM along with the configuration + + String[] + + + InformationAction + + + + ActionPreference + + + InformationVariable + + + + String + + + WhatIf + + Describes what would happen if you executed the command without actually executing the command. + + SwitchParameter + + + Confirm + + Prompts you for confirmation before executing the command. + + SwitchParameter + + + + Publish-AzureRmVMDscConfiguration + + ConfigurationPath + + Path to a file containing one or more configurations. The file can be a PowerShell script (.ps1 file), module (.psm1 file). + + String + + + OutputArchivePath + + Path to a local ZIP file to write the configuration archive to. When this parameter is used, the configuration script is not uploaded to Azure blob storage. + + String + + + Force + + By default Publish-AzureRmVMDscConfiguration will not overwrite any existing blobs or files. Use -Force to overwrite them. + + SwitchParameter + + + SkipDependencyDetection + + Excludes DSC resource dependencies from the configuration archive. + + SwitchParameter + + + ConfigurationDataPath + + Path to a .psd1 file that specifies the data for the Configuration. This is added to the configuration archive and then passed to the configuration function. It gets overwritten by the configuration data path provided through the Set-AzureRmVMDscExtension cmdlet + + String + + + AdditionalPath + + Path to a file or a directory to include in the configuration archive. It gets downloaded to the VM along with the configuration + + String[] + + + InformationAction + + + + ActionPreference + + + InformationVariable + + + + String + + + WhatIf + + Describes what would happen if you executed the command without actually executing the command. + + SwitchParameter + + + Confirm + + Prompts you for confirmation before executing the command. + + SwitchParameter + + + + + + ResourceGroupName + + The name of the resource group that contains the storage account + + String + + String + + + + + + ConfigurationPath + + Path to a file containing one or more configurations. The file can be a PowerShell script (.ps1 file), module (.psm1 file). + + String + + String + + + + + + ContainerName + + Name of the Azure Storage Container the configuration is uploaded to. + + String + + String + + + + + + StorageAccountName + + The Azure Storage Account name used to upload the configuration script to the container specified by ContainerName + + String + + String + + + + + + StorageEndpointSuffix + + Suffix for the storage end point, e.g. core.windows.net + + String + + String + + + + + + Force + + By default Publish-AzureRmVMDscConfiguration will not overwrite any existing blobs or files. Use -Force to overwrite them. + + SwitchParameter + + SwitchParameter + + + + + + SkipDependencyDetection + + Excludes DSC resource dependencies from the configuration archive. + + SwitchParameter + + SwitchParameter + + + + + + ConfigurationDataPath + + Path to a .psd1 file that specifies the data for the Configuration. This is added to the configuration archive and then passed to the configuration function. It gets overwritten by the configuration data path provided through the Set-AzureRmVMDscExtension cmdlet + + String + + String + + + + + + AdditionalPath + + Path to a file or a directory to include in the configuration archive. It gets downloaded to the VM along with the configuration + + String[] + + String[] + + + + + + InformationAction + + + + ActionPreference + + ActionPreference + + + + + + InformationVariable + + + + String + + String + + + + + + WhatIf + + Describes what would happen if you executed the command without actually executing the command. + + SwitchParameter + + SwitchParameter + + + + + + Confirm + + Prompts you for confirmation before executing the command. + + SwitchParameter + + SwitchParameter + + + + + + OutputArchivePath + + Path to a local ZIP file to write the configuration archive to. When this parameter is used, the configuration script is not uploaded to Azure blob storage. + + String + + String + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Keywords: azure, azurerm, arm, resource, management, manager, compute, vm, iaas + + + + + -------------------------- EXAMPLE 1 -------------------------- + + PS C:\> + + Publish-AzureRmVMDscConfiguration .\MyConfiguration.ps1 + + Description + + + + + + + + + + + + + + -------------------------- EXAMPLE 2 -------------------------- + + PS C:\> + + Publish-AzureRmVMDscConfiguration .\MyConfiguration.ps1 -OutputArchivePath .\MyConfiguration.ps1.zip + + Description + + + + + + + + + + + + + + -------------------------- EXAMPLE 3 -------------------------- + + PS C:\> + + Publish-AzureRmVMDscConfiguration -ConfigurationPath 'C:\Sample.ps1 -SkipDependencyDetection + + Description + + + + + + + + + + + + + + -------------------------- EXAMPLE 4 -------------------------- + + PS C:\> + + Publish-AzureRmVMDscConfiguration -ConfigurationPath C:\Sample.ps1 -ConfigurationDataPath 'C:\SampleData.psd1' + + Description + + + + + + + + + + + + + + -------------------------- EXAMPLE 5 -------------------------- + + PS C:\> + + Publish-AzureRmVMDscConfiguration -ConfigurationPath "C:\Sample.ps1" -AdditionalPath @("C:\ContentDir1", "C:\File.txt") -ConfigurationDataPath "C:\SampleData.psd1" + + Description + + + + + + + + + + + + + + + + Unknown + + + + + + + + Remove-AzureRmAvailabilitySet + + Removes an availability set from Azure. + + + + + Remove + AzureRmAvailabilitySet + + + + The Remove-AzureRmAvailabilitySet cmdlet removes an availability set from Azure. + + + + Remove-AzureRmAvailabilitySet + + ResourceGroupName + + Specifies the name of a resource group. + + String + + + Name + + Specifies the name of the availability set to remove. + + String + + + Force + + Forces the command to run without asking for user confirmation. + + SwitchParameter + + + InformationAction + + + + ActionPreference + + + InformationVariable + + + + String + + + + + + ResourceGroupName + + Specifies the name of a resource group. + + String + + String + + + none + + + Name + + Specifies the name of the availability set to remove. + + String + + String + + + none + + + Force + + Forces the command to run without asking for user confirmation. + + SwitchParameter + + SwitchParameter + + + none + + + InformationAction + + + + ActionPreference + + ActionPreference + + + + + + InformationVariable + + + + String + + String + + + + + + Profile + + Specifies the Azure profile from which this cmdlet reads. If you do not specify a profile, this cmdlet reads from the local default profile. + + azureprofile + + azureprofile + + + none + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Keywords: azure, azurerm, arm, resource, management, manager, compute, vm, iaas + + + + + -------------------------- Example 1: Remove an availability set -------------------------- + + PS C:\> + + PS C:\>Remove-AzureRmAvailabilitySet -Name "AvailabilitySet03" -ResourceGroupName "ResourceGroup11" + + This command removes an availability set named AvailablitySet03 in the resource group named ResourceGroup11. + + + + + + + + + + + + + + + + Get-AzureRmAvailabilitySet + + + + New-AzureRmAvailabilitySet + + + + + + + + Remove-AzureRmVM + + Removes a virtual machine from Azure. + + + + + Remove + AzureRmVM + + + + The Remove-AzureRmVM cmdlet removes a virtual machine from Azure. + + + + Remove-AzureRmVM + + Name + + Specifies the name of the virtual machine to remove. + + String + + + Force + + Forces the command to run without asking for user confirmation. + + SwitchParameter + + + ResourceGroupName + + Specifies the name of a resource group. + + String + + + InformationAction + + + + ActionPreference + + + InformationVariable + + + + String + + + + Remove-AzureRmVM + + Name + + Specifies the name of the virtual machine to remove. + + String + + + Force + + Forces the command to run without asking for user confirmation. + + SwitchParameter + + + Id + + + + String + + + InformationAction + + + + ActionPreference + + + InformationVariable + + + + String + + + + + + Name + + Specifies the name of the virtual machine to remove. + + String + + String + + + none + + + Force + + Forces the command to run without asking for user confirmation. + + SwitchParameter + + SwitchParameter + + + none + + + ResourceGroupName + + Specifies the name of a resource group. + + String + + String + + + none + + + InformationAction + + + + ActionPreference + + ActionPreference + + + + + + InformationVariable + + + + String + + String + + + + + + Id + + + + String + + String + + + + + + Profile + + Specifies the Azure profile from which this cmdlet reads. If you do not specify a profile, this cmdlet reads from the local default profile. + + azureprofile + + azureprofile + + + none + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Keywords: azure, azurerm, arm, resource, management, manager, compute, vm, iaas + + + + + -------------------------- Example 1: Remove a virtual machine -------------------------- + + PS C:\> + + PS C:\>Remove-AzureRmVM -ResourceGroupName "ResourceGroup11" -Name "VirtualMachine07" + + This command removes the virtual machine named VirtualMachine07 in the resource group ResourceGroup11. + + + + + + + + + + + + + + + + Get-AzureRmVM + + + + New-AzureRmVM + + + + Restart-AzureRmVM + + + + Start-AzureRmVM + + + + Stop-AzureRmVM + + + + Update-AzureRmVM + + + + + + + + Remove-AzureRmVMAccessExtension + + Removes the VMAccess extension from a virtual machine. + + + + + Remove + AzureRmVMAccessExtension + + + + The Remove-AzureRmVMAccessExtension cmdlet removes the Virtual Machine Access (VMAccess) Virtual Machine Extension from a virtual machine. + + + + Remove-AzureRmVMAccessExtension + + ResourceGroupName + + Specifies the name of the resource group of the virtual machine. + + String + + + VMName + + Specifies the name of a virtual machine. This cmdlet removes VMAccess for the virtual machine that this parameter specifies. + + String + + + Name + + Specifies the name of the extension that this cmdlet removes. + + String + + + Force + + Forces the command to run without asking for user confirmation. + + SwitchParameter + + + InformationAction + + + + ActionPreference + + + InformationVariable + + + + String + + + + + + ResourceGroupName + + Specifies the name of the resource group of the virtual machine. + + String + + String + + + none + + + VMName + + Specifies the name of a virtual machine. This cmdlet removes VMAccess for the virtual machine that this parameter specifies. + + String + + String + + + none + + + Name + + Specifies the name of the extension that this cmdlet removes. + + String + + String + + + none + + + Force + + Forces the command to run without asking for user confirmation. + + SwitchParameter + + SwitchParameter + + + none + + + InformationAction + + + + ActionPreference + + ActionPreference + + + + + + InformationVariable + + + + String + + String + + + + + + Profile + + Specifies the Azure profile from which this cmdlet reads. If you do not specify a profile, this cmdlet reads from the local default profile. + + azureprofile + + azureprofile + + + none + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Keywords: azure, azurerm, arm, resource, management, manager, compute, vm, iaas + + + + + -------------------------- 1: -------------------------- + + PS C:\> + + + + + + + + + + + + + + + + + + + + Get-AzureRmVMAccessExtension + + + + Set-AzureRmVMAccessExtension + + + + Remove-AzureRmVMExtension + + + + + + + + Remove-AzureRmVMBackup + + Remove-AzureRmVMBackup cmdlet remove the VM Backup for the VM. + + + + + Remove + AzureRmVMBackup + + + + + + + + Remove-AzureRmVMBackup + + ResourceGroupName + + Resource group name of the virtual machine + + String + + + VMName + + Name of the virtual machine + + String + + + Tag + + The tag for the VM Backup. This is used for identify the backups. + + String + + + InformationAction + + + + ActionPreference + + + InformationVariable + + + + String + + + + + + ResourceGroupName + + Resource group name of the virtual machine + + String + + String + + + + + + VMName + + Name of the virtual machine + + String + + String + + + + + + Tag + + The tag for the VM Backup. This is used for identify the backups. + + String + + String + + + + + + InformationAction + + + + ActionPreference + + ActionPreference + + + + + + InformationVariable + + + + String + + String + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Remove-AzureRmVMCustomScriptExtension + + Removes a custom script extension from a virtual machine. + + + + + Remove + AzureRmVMCustomScriptExtension + + + + The Remove-AzureRmVMCustomScriptExtension cmdlet removes a custom script Virtual Machine Extension from a virtual machine. + + + + Remove-AzureRmVMCustomScriptExtension + + ResourceGroupName + + Specifies the name of the resource group of the virtual machine. + + String + + + VMName + + Specifies the name of a virtual machine from which this cmdlet removes the custom script extension. + + String + + + Name + + Specifies the name of the custom script extension that this cmdlet removes. + + String + + + Force + + Forces the command to run without asking for user confirmation. + + SwitchParameter + + + InformationAction + + + + ActionPreference + + + InformationVariable + + + + String + + + + + + ResourceGroupName + + Specifies the name of the resource group of the virtual machine. + + String + + String + + + none + + + VMName + + Specifies the name of a virtual machine from which this cmdlet removes the custom script extension. + + String + + String + + + none + + + Name + + Specifies the name of the custom script extension that this cmdlet removes. + + String + + String + + + none + + + Force + + Forces the command to run without asking for user confirmation. + + SwitchParameter + + SwitchParameter + + + none + + + InformationAction + + + + ActionPreference + + ActionPreference + + + + + + InformationVariable + + + + String + + String + + + + + + Profile + + Specifies the Azure profile from which this cmdlet reads. If you do not specify a profile, this cmdlet reads from the local default profile. + + azureprofile + + azureprofile + + + none + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Keywords: azure, azurerm, arm, resource, management, manager, compute, vm, iaas + + + + + -------------------------- 1: -------------------------- + + PS C:\> + + + + + + + + + + + + + + + + + + + + Get-AzureRmVMCustomScriptExtension + + + + Set-AzureRmVMCustomScriptExtension + + + + + + + + Remove-AzureRmVMDataDisk + + Removes a data disk from a virtual machine. + + + + + Remove + AzureRmVMDataDisk + + + + The Remove-AzureRmVMDataDisk cmdlet removes a data disk from a virtual machine. + + + + Remove-AzureRmVMDataDisk + + VM + + Specifies the local virtual machine object from which to remove a data disk. To obtain a virtual machine object, use the Get-AzureRmVM cmdlet. + + PSVirtualMachine + + + DataDiskNames + + + + String[] + + + InformationAction + + + + ActionPreference + + + InformationVariable + + + + String + + + + + + VM + + Specifies the local virtual machine object from which to remove a data disk. To obtain a virtual machine object, use the Get-AzureRmVM cmdlet. + + PSVirtualMachine + + PSVirtualMachine + + + none + + + DataDiskNames + + + + String[] + + String[] + + + + + + InformationAction + + + + ActionPreference + + ActionPreference + + + + + + InformationVariable + + + + String + + String + + + + + + Name + + Specifies the name of the data disk to add. + + string + + string + + + none + + + Profile + + Specifies the Azure profile from which this cmdlet reads. If you do not specify a profile, this cmdlet reads from the local default profile. + + azureprofile + + azureprofile + + + none + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Keywords: azure, azurerm, arm, resource, management, manager, compute, vm, iaas + + + + + -------------------------- Example 1: Remove a data disk from a virtual machine -------------------------- + + PS C:\> + + PS C:\>$VirtualMachine = Get-AzureRmVM -ResourceGroupName "ResourceGroup11" -Name "VirtualMachine07" +PS C:\> Remove-AzureRmVMDataDisk -VM $VirtualMachine -Name "disk3" +PS C:\> Update-AzureRmVM -ResourceGroupName "ResourceGroup11" -Name "VirtualMachine07" -VM $VirtualMachine + + The first command gets the virtual machine named VirtualMachine07 by using the Get-AzureRmVM cmdlet. The command stores the virtual machine in the $VirtualMachine variable. + + + + + + + + + + + + + + + + Add-AzureRmVMDataDisk + + + + Get-AzureRmVM + + + + + + + + Remove-AzureRmVMDiagnosticsExtension + + + + + + + Remove + AzureRmVMDiagnosticsExtension + + + + + + + + Remove-AzureRmVMDiagnosticsExtension + + ResourceGroupName + + + + String + + + VMName + + + + String + + + Name + + + + String + + + InformationAction + + + + ActionPreference + + + InformationVariable + + + + String + + + + + + ResourceGroupName + + + + String + + String + + + + + + VMName + + + + String + + String + + + + + + Name + + + + String + + String + + + + + + InformationAction + + + + ActionPreference + + ActionPreference + + + + + + InformationVariable + + + + String + + String + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Remove-AzureRmVMDiskEncryptionExtension + + Remove-AzureRmVMDiskEncryptionExtension cmdlet deletes disk encryption extension from the VM. If no extension name is specified, this cmdlet removes extension with default name 'AzureDiskEncryption' for Windows VMs and 'AzureDiskEncryptionForLinux' for Linux VMs. + + + + + Remove + AzureRmVMDiskEncryptionExtension + + + + + + + + Remove-AzureRmVMDiskEncryptionExtension + + ResourceGroupName + + Resource group name of the virtual machine + + String + + + VMName + + Name of the virtual machine + + String + + + Name + + Name of the ARM resource that represents the extension. The Set-AzureRmVMDiskEncryptionExtension cmdlet sets this name to 'AzureDiskEncryption' for Windows VMs and 'AzureDiskEncryptionForLinux' for Linux VMs. Which is the same as the default value used by Remove-AzureRmVMAzureDiskEncryptionExtension. Specify this parameter only if you changed the default name in the Set cmdlet or used a different resource name in an ARM template + + String + + + Force + + Force switch removes the extension without prompting for a confirmation + + SwitchParameter + + + InformationAction + + + + ActionPreference + + + InformationVariable + + + + String + + + + + + ResourceGroupName + + Resource group name of the virtual machine + + String + + String + + + + + + VMName + + Name of the virtual machine + + String + + String + + + + + + Name + + Name of the ARM resource that represents the extension. The Set-AzureRmVMDiskEncryptionExtension cmdlet sets this name to 'AzureDiskEncryption' for Windows VMs and 'AzureDiskEncryptionForLinux' for Linux VMs. Which is the same as the default value used by Remove-AzureRmVMAzureDiskEncryptionExtension. Specify this parameter only if you changed the default name in the Set cmdlet or used a different resource name in an ARM template + + String + + String + + + + + + Force + + Force switch removes the extension without prompting for a confirmation + + SwitchParameter + + SwitchParameter + + + + + + InformationAction + + + + ActionPreference + + ActionPreference + + + + + + InformationVariable + + + + String + + String + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + -------------------------- Example 1 -------------------------- + + PS C:\> + + $rgName = 'MyResourceGroup'; +$vmName = 'MyWindowsVM'; +Remove-AzureRmVMDiskEncryptionExtension -ResourceGroupName $rgname -VMName $vmName; + + + + + + + + + + + + + + + + -------------------------- Example 2 -------------------------- + + PS C:\> + + $rgName = 'MyResourceGroup'; +$vmName = 'MyWindowsVM'; +$extensionNmae = 'MyDiskEncryptionExtension' +Remove-AzureRmVMDiskEncryptionExtension -ResourceGroupName $rgname -VMName $vmName -Name $extensionNmae; + + + + + + + + + + + + + + + + + + + + + + Remove-AzureRmVMDscExtension + + Removes DSC extension handler from a VM in a resource group + + + + + Remove + AzureRmVMDscExtension + + + + Removes DSC extension handler from a VM in a resource group + + + + Remove-AzureRmVMDscExtension + + ResourceGroupName + + The name of the resource group + + String + + + VMName + + The name of the virtual machine + + String + + + Name + + Name of the ARM resource that represents the extension. The Set-AzureRmVMDscExtension cmdlet sets this name to 'Microsoft.Powershell.DSC', which is the same value used by Remove-AzureRmVMDscExtension. Specify this parameter only if you changed the default name in the Set cmdlet or used a different resource name in an ARM template + + String + + + InformationAction + + + + ActionPreference + + + InformationVariable + + + + String + + + WhatIf + + + + SwitchParameter + + + Confirm + + + + SwitchParameter + + + + + + ResourceGroupName + + The name of the resource group + + String + + String + + + + + + VMName + + The name of the virtual machine + + String + + String + + + + + + Name + + Name of the ARM resource that represents the extension. The Set-AzureRmVMDscExtension cmdlet sets this name to 'Microsoft.Powershell.DSC', which is the same value used by Remove-AzureRmVMDscExtension. Specify this parameter only if you changed the default name in the Set cmdlet or used a different resource name in an ARM template + + String + + String + + + + + + InformationAction + + + + ActionPreference + + ActionPreference + + + + + + InformationVariable + + + + String + + String + + + + + + WhatIf + + + + SwitchParameter + + SwitchParameter + + + + + + Confirm + + + + SwitchParameter + + SwitchParameter + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Keywords: azure, azurerm, arm, resource, management, manager, compute, vm, iaas + + + + + -------------------------- Example 1 -------------------------- + + PS C:\> + + PS C:\> Remove-AzureRmVMDscExtension –ResouceGroupName Name -VMName VM -Name DSC + + Description + + + + + + + + + + + + + + + + + + + + Remove-AzureRmVMExtension + + Removes an extension from a virtual machine. + + + + + Remove + AzureRmVMExtension + + + + The Remove-AzureRmVMExtension cmdlet removes an extension from the Virtual Machine Extensions of a virtual machine. + + + + Remove-AzureRmVMExtension + + ResourceGroupName + + Specifies the name of a resource group. + + String + + + VMName + + Specifies the name of a virtual machine. This cmdlet removes extensions from the virtual machine that this parameter specifies. + + String + + + Name + + Specifies the name of the extension to remove. + + String + + + Force + + Forces the command to run without asking for user confirmation. + + SwitchParameter + + + InformationAction + + + + ActionPreference + + + InformationVariable + + + + String + + + + + + ResourceGroupName + + Specifies the name of a resource group. + + String + + String + + + none + + + VMName + + Specifies the name of a virtual machine. This cmdlet removes extensions from the virtual machine that this parameter specifies. + + String + + String + + + none + + + Name + + Specifies the name of the extension to remove. + + String + + String + + + none + + + Force + + Forces the command to run without asking for user confirmation. + + SwitchParameter + + SwitchParameter + + + none + + + InformationAction + + + + ActionPreference + + ActionPreference + + + + + + InformationVariable + + + + String + + String + + + + + + Profile + + Specifies the Azure profile from which this cmdlet reads. If you do not specify a profile, this cmdlet reads from the local default profile. + + azureprofile + + azureprofile + + + none + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Keywords: azure, azurerm, arm, resource, management, manager, compute, vm, iaas + + + + + -------------------------- Example 1: Remove an extension from a virtual machine -------------------------- + + PS C:\> + + PS C:\>Remove-AzureRmVMExtension -ResourceGroupName "ResourceGroup11" -Name "ContosoTest" -VMName "VirtualMachine22" + + This command removes the extension named ContosoTest from the virtual machine named VirtualMachine22 in ResourceGroup11. + + + + + + + + + + + + + + + + Get-AzureRmVMExtension + + + + Set-AzureRmVMExtension + + + + + + + + Remove-AzureRmVMNetworkInterface + + Removes a network interface from a virtual machine. + + + + + Remove + AzureRmVMNetworkInterface + + + + The Remove-AzureRmVMNetworkInterface cmdlet removes a network interface from a virtual machine. + + + + Remove-AzureRmVMNetworkInterface + + VM + + Specifies the virtual machine from which this cmdlet removes a network interface. To obtain a virtual machine object, use the Get-AzureRmVM cmdlet. + + PSVirtualMachine + + + NetworkInterfaceIDs + + + + String[] + + + InformationAction + + + + ActionPreference + + + InformationVariable + + + + String + + + + + + VM + + Specifies the virtual machine from which this cmdlet removes a network interface. To obtain a virtual machine object, use the Get-AzureRmVM cmdlet. + + PSVirtualMachine + + PSVirtualMachine + + + none + + + NetworkInterfaceIDs + + + + String[] + + String[] + + + + + + InformationAction + + + + ActionPreference + + ActionPreference + + + + + + InformationVariable + + + + String + + String + + + + + + Id + + Specifies the ID of the network interface that this cmdlet removes from the virtual machine. + + string + + string + + + none + + + Profile + + Specifies the Azure profile from which this cmdlet reads. If you do not specify a profile, this cmdlet reads from the local default profile. + + azureprofile + + azureprofile + + + none + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Keywords: azure, azurerm, arm, resource, management, manager, compute, vm, iaas + + + + + -------------------------- 1: -------------------------- + + PS C:\> + + + + + + + + + + + + + + + + + + + + Get-AzureRmVM + + + + + + + + Remove-AzureRmVMSqlServerExtension + + + + + + + Remove + AzureRmVMSqlServerExtension + + + + + + + + Remove-AzureRmVMSqlServerExtension + + ResourceGroupName + + + + String + + + VMName + + + + String + + + Name + + + + String + + + InformationAction + + + + ActionPreference + + + InformationVariable + + + + String + + + + + + ResourceGroupName + + + + String + + String + + + + + + VMName + + + + String + + String + + + + + + Name + + + + String + + String + + + + + + InformationAction + + + + ActionPreference + + ActionPreference + + + + + + InformationVariable + + + + String + + String + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Restart-AzureRmVM + + Restarts an Azure virtual machine. + + + + + Restart + AzureRmVM + + + + The Restart-AzureRmVM cmdlet restarts an Azure virtual machine. + + + + Restart-AzureRmVM + + Name + + Specifies the name of the virtual machine to restart. + + String + + + ResourceGroupName + + Specifies the name of the resource group. + + String + + + InformationAction + + + + ActionPreference + + + InformationVariable + + + + String + + + + Restart-AzureRmVM + + Name + + Specifies the name of the virtual machine to restart. + + String + + + Id + + + + String + + + InformationAction + + + + ActionPreference + + + InformationVariable + + + + String + + + + + + Name + + Specifies the name of the virtual machine to restart. + + String + + String + + + none + + + ResourceGroupName + + Specifies the name of the resource group. + + String + + String + + + none + + + InformationAction + + + + ActionPreference + + ActionPreference + + + + + + InformationVariable + + + + String + + String + + + + + + Id + + + + String + + String + + + + + + Profile + + Specifies the Azure profile from which this cmdlet reads. If you do not specify a profile, this cmdlet reads from the local default profile. + + azureprofile + + azureprofile + + + none + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Keywords: azure, azurerm, arm, resource, management, manager, compute, vm, iaas + + + + + -------------------------- Example 1: Restart a virtual machine -------------------------- + + PS C:\> + + PS C:\>Restart-AzureRmVM -ResourceGroupName "ResourceGroup11" -Name "VirtualMachine07" + + This command restarts the virtual machine named VirtualMachine07 in ResourceGroup11. + + + + + + + + + + + + + + + + Get-AzureRmVM + + + + New-AzureRmVM + + + + Remove-AzureRmVM + + + + Start-AzureRmVM + + + + Stop-AzureRmVM + + + + Update-AzureRmVM + + + + + + + + Save-AzureRmVhd + + + + + + + Save + AzureRmVhd + + + + + + + + Save-AzureRmVhd + + ResourceGroupName + + + + String + + + SourceUri + + + + Uri + + + LocalFilePath + + + + FileInfo + + + NumberOfThreads + + + + Int32 + + + OverWrite + + + + SwitchParameter + + + InformationAction + + + + ActionPreference + + + InformationVariable + + + + String + + + + Save-AzureRmVhd + + StorageKey + + + + String + + + SourceUri + + + + Uri + + + LocalFilePath + + + + FileInfo + + + NumberOfThreads + + + + Int32 + + + OverWrite + + + + SwitchParameter + + + InformationAction + + + + ActionPreference + + + InformationVariable + + + + String + + + + + + ResourceGroupName + + + + String + + String + + + + + + SourceUri + + + + Uri + + Uri + + + + + + LocalFilePath + + + + FileInfo + + FileInfo + + + + + + NumberOfThreads + + + + Int32 + + Int32 + + + + + + OverWrite + + + + SwitchParameter + + SwitchParameter + + + + + + InformationAction + + + + ActionPreference + + ActionPreference + + + + + + InformationVariable + + + + String + + String + + + + + + StorageKey + + + + String + + String + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Save-AzureRmVMImage + + Captures a virtual machine as a VMImage. + + + + + Save + AzureRmVMImage + + + + The Save-AzureRmVMImage cmdlet captures a virtual machine as a VMImage. Before you create a virtual machine image, sysprep the virtual machine, and then mark it as generalized by using the Set-AzureRmVM cmdlet. + The output of this cmdlet is a JavaScript Object Notation (JSON) template. You can deploy virtual machines from your captured image. + + + + Save-AzureRmVMImage + + Name + + + + String + + + DestinationContainerName + + Specifies the name of a container. The virtual hard disks (VHDs) that constitute the VMImage reside in the container that this parameter specifies. If the VHDs are spread across multiple storage accounts, this cmdlet creates one container that has this name in each storage account. + + String + + + VHDNamePrefix + + Specifies the prefix in the name of the blobs that constitute the storage profile of the VMImage. For example, a prefix vhdPrefix for operating system disk results in the name vhdPrefix-osdisk. + + String + + + Overwrite + + Indicates that this cmdlet overwrites any VHDs that have the same prefix in the destination container. + + SwitchParameter + + + Path + + + + String + + + ResourceGroupName + + Specifies the name of the resource group of the virtual machine. + + String + + + InformationAction + + + + ActionPreference + + + InformationVariable + + + + String + + + + Save-AzureRmVMImage + + Name + + + + String + + + DestinationContainerName + + Specifies the name of a container. The virtual hard disks (VHDs) that constitute the VMImage reside in the container that this parameter specifies. If the VHDs are spread across multiple storage accounts, this cmdlet creates one container that has this name in each storage account. + + String + + + VHDNamePrefix + + Specifies the prefix in the name of the blobs that constitute the storage profile of the VMImage. For example, a prefix vhdPrefix for operating system disk results in the name vhdPrefix-osdisk. + + String + + + Overwrite + + Indicates that this cmdlet overwrites any VHDs that have the same prefix in the destination container. + + SwitchParameter + + + Path + + + + String + + + Id + + + + String + + + InformationAction + + + + ActionPreference + + + InformationVariable + + + + String + + + + + + Name + + + + String + + String + + + + + + DestinationContainerName + + Specifies the name of a container. The virtual hard disks (VHDs) that constitute the VMImage reside in the container that this parameter specifies. If the VHDs are spread across multiple storage accounts, this cmdlet creates one container that has this name in each storage account. + + String + + String + + + none + + + VHDNamePrefix + + Specifies the prefix in the name of the blobs that constitute the storage profile of the VMImage. For example, a prefix vhdPrefix for operating system disk results in the name vhdPrefix-osdisk. + + String + + String + + + none + + + Overwrite + + Indicates that this cmdlet overwrites any VHDs that have the same prefix in the destination container. + + SwitchParameter + + SwitchParameter + + + none + + + Path + + + + String + + String + + + + + + ResourceGroupName + + Specifies the name of the resource group of the virtual machine. + + String + + String + + + none + + + InformationAction + + + + ActionPreference + + ActionPreference + + + + + + InformationVariable + + + + String + + String + + + + + + Id + + + + String + + String + + + + + + Profile + + Specifies the Azure profile from which this cmdlet reads. If you do not specify a profile, this cmdlet reads from the local default profile. + + azureprofile + + azureprofile + + + none + + + VMName + + Specifies the name of the virtual machine that this cmdlet saves. + + string + + string + + + none + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Keywords: azure, azurerm, arm, resource, management, manager, compute, vm, iaas + + + + + -------------------------- Example 1: Capture a virtual machine -------------------------- + + PS C:\> + + PS C:\>Set-AzureRmVM -ResourceGroupName "ResourceGroup11" -Name "VirtualMachine07" -Generalized +PS C:\> Save-AzureRmVMImage -ResourceGroupName "ResourceGroup11" -VMName "VirtualMachine07" -DestinationContainerName "VMContainer01" -VHDNamePrefix "VM07" + + The first marks the virtual machine named VirtualMachine07 as generalized. + + + + + + + + + + + + + + + + Get-AzureRmVMImage + + + + Get-AzureRmVMImageOffer + + + + Get-AzureRmVMImagePublisher + + + + Get-AzureRmVMImageSku + + + + Set-AzureRmVM + + + + + + + + Set-AzureRmVM + + Marks a virtual machine as generalized. + + + + + Set + AzureRmVM + + + + The Set-AzureRmVM cmdlet marks a virtual machine as generalized. Before you run this cmdlet, log on to the virtual machine and use Sysprep to prepare the hard disk. + + + + Set-AzureRmVM + + Name + + Specifies the name of the virtual machine on which this cmdlet operates. + + String + + + Generalized + + Indicates that this cmdlet marks a virtual machine as generalized. + + SwitchParameter + + + ResourceGroupName + + Specifies the name of the resource group of the virtual machine. + + String + + + InformationAction + + + + ActionPreference + + + InformationVariable + + + + String + + + + Set-AzureRmVM + + Name + + Specifies the name of the virtual machine on which this cmdlet operates. + + String + + + Generalized + + Indicates that this cmdlet marks a virtual machine as generalized. + + SwitchParameter + + + Id + + + + String + + + InformationAction + + + + ActionPreference + + + InformationVariable + + + + String + + + + + + Name + + Specifies the name of the virtual machine on which this cmdlet operates. + + String + + String + + + none + + + Generalized + + Indicates that this cmdlet marks a virtual machine as generalized. + + SwitchParameter + + SwitchParameter + + + none + + + ResourceGroupName + + Specifies the name of the resource group of the virtual machine. + + String + + String + + + none + + + InformationAction + + + + ActionPreference + + ActionPreference + + + + + + InformationVariable + + + + String + + String + + + + + + Id + + + + String + + String + + + + + + Profile + + Specifies the Azure profile from which this cmdlet reads. If you do not specify a profile, this cmdlet reads from the local default profile. + + azureprofile + + azureprofile + + + none + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Keywords: azure, azurerm, arm, resource, management, manager, compute, vm, iaas + + + + + -------------------------- Example 1: Mark a virtual machine as generalized -------------------------- + + PS C:\> + + PS C:\>Set-AzureRmVM -ResourceGroupName "ResourceGroup11" -Name "VirtualMachine07" -Generalized + + This command marks the virtual machine named VirtualMachine07 as generalized. + + + + + + + + + + + + + + + + Get-AzureRmVM + + + + + + + + Set-AzureRmVMAccessExtension + + Adds the VMAccess extension to a virtual machine. + + + + + Set + AzureRmVMAccessExtension + + + + The Set-AzureRmVMAccessExtension cmdlet adds the Virtual Machine Access (VMAccess) Virtual Machine Extension to a virtual machine. VMAccess can reset the virtual machine user name and password. + + + + Set-AzureRmVMAccessExtension + + ResourceGroupName + + Specifies the name of the resource group of the virtual machine. + + String + + + VMName + + Specifies the name of a virtual machine. This cmdlet adds VMAccess for the virtual machine that this parameter specifies. + + String + + + Name + + Specifies the name of the extension that this cmdlet adds. + + String + + + TypeHandlerVersion + + Specifies the version of the extension to use for this virtual machine. To obtain the version, run the Get-AzureRmVMExtensionImage cmdlet with a value of Microsoft.Compute for the PublisherName parameter and VMAccessAgent for the Type parameter. + + String + + + UserName + + Specifies the new user name for the virtual machine. + + String + + + Password + + Specifies the new password of the virtual machine. + + String + + + Location + + Specifies the location of the virtual machine. + + String + + + InformationAction + + + + ActionPreference + + + InformationVariable + + + + String + + + + + + ResourceGroupName + + Specifies the name of the resource group of the virtual machine. + + String + + String + + + none + + + VMName + + Specifies the name of a virtual machine. This cmdlet adds VMAccess for the virtual machine that this parameter specifies. + + String + + String + + + none + + + Name + + Specifies the name of the extension that this cmdlet adds. + + String + + String + + + none + + + TypeHandlerVersion + + Specifies the version of the extension to use for this virtual machine. To obtain the version, run the Get-AzureRmVMExtensionImage cmdlet with a value of Microsoft.Compute for the PublisherName parameter and VMAccessAgent for the Type parameter. + + String + + String + + + none + + + UserName + + Specifies the new user name for the virtual machine. + + String + + String + + + none + + + Password + + Specifies the new password of the virtual machine. + + String + + String + + + none + + + Location + + Specifies the location of the virtual machine. + + String + + String + + + none + + + InformationAction + + + + ActionPreference + + ActionPreference + + + + + + InformationVariable + + + + String + + String + + + + + + Profile + + Specifies the Azure profile from which this cmdlet reads. If you do not specify a profile, this cmdlet reads from the local default profile. + + azureprofile + + azureprofile + + + none + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Keywords: azure, azurerm, arm, resource, management, manager, compute, vm, iaas + + + + + -------------------------- Example 1: Add a VMAccess extension -------------------------- + + PS C:\> + + PS C:\> Set-AzureRmVMAccessExtension -ResourceGroupName "ResrouceGroup11" -Location "Central US" -VMName "VirtualMachine07" -Name "ContosoTest" -TypeHandlerVersion "2.0" -UserName "PFuller" -Password "Password" + + This command adds a VMAccess extension for the virtual machine named VirtualMachine07 in ResrouceGroup11. The command specifies the name and type handler version for VMAccess. + + + + + + + + + + + + + + + + Get-AzureRmVMAccessExtension + + + + Remove-AzureRmVMAccessExtension + + + + Set-AzureRmVMExtension + + + + Get-AzureRmVMExtensionImage + + + + + + + + Set-AzureRmVMBackupExtension + + Set-AzureRmVMBackupExtension cmdlet create a backup for this VM. + + + + + Set + AzureRmVMBackupExtension + + + + + + + + Set-AzureRmVMBackupExtension + + ResourceGroupName + + Resource group name of the virtual machine + + String + + + VMName + + Name of the virtual machine + + String + + + Name + + Name of the ARM resource that represents the extension. This is 'VMBackupForLinuxExtension' for Linux VMs. + + String + + + Tag + + The tag for the VM Backup. This is used for identify the backups. + + String + + + InformationAction + + + + ActionPreference + + + InformationVariable + + + + String + + + + + + ResourceGroupName + + Resource group name of the virtual machine + + String + + String + + + + + + VMName + + Name of the virtual machine + + String + + String + + + + + + Name + + Name of the ARM resource that represents the extension. This is 'VMBackupForLinuxExtension' for Linux VMs. + + String + + String + + + + + + Tag + + The tag for the VM Backup. This is used for identify the backups. + + String + + String + + + + + + InformationAction + + + + ActionPreference + + ActionPreference + + + + + + InformationVariable + + + + String + + String + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Set-AzureRmVMBootDiagnostics + + + + + + + Set + AzureRmVMBootDiagnostics + + + + + + + + Set-AzureRmVMBootDiagnostics + + VM + + + + PSVirtualMachine + + + Enable + + + + SwitchParameter + + + ResourceGroupName + + + + String + + + StorageAccountName + + + + String + + + InformationAction + + + + ActionPreference + + + InformationVariable + + + + String + + + + Set-AzureRmVMBootDiagnostics + + VM + + + + PSVirtualMachine + + + Disable + + + + SwitchParameter + + + InformationAction + + + + ActionPreference + + + InformationVariable + + + + String + + + + + + VM + + + + PSVirtualMachine + + PSVirtualMachine + + + + + + Enable + + + + SwitchParameter + + SwitchParameter + + + + + + ResourceGroupName + + + + String + + String + + + + + + StorageAccountName + + + + String + + String + + + + + + InformationAction + + + + ActionPreference + + ActionPreference + + + + + + InformationVariable + + + + String + + String + + + + + + Disable + + + + SwitchParameter + + SwitchParameter + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Set-AzureRmVMCustomScriptExtension + + Adds a custom script extension to a virtual machine. + + + + + Set + AzureRmVMCustomScriptExtension + + + + The Set-AzureRmVMCustomScriptExtension cmdlet adds a custom script Virtual Machine Extension to a virtual machine. This extension allows you to run your own scripts on the virtual machine. + + + + Set-AzureRmVMCustomScriptExtension + + ResourceGroupName + + Specifies the name of the resource group of the virtual machine. + + String + + + VMName + + Specifies the name of a virtual machine. This cmdlet adds the custom script extension for the virtual machine that this parameter specifies. + + String + + + Name + + Specifies the name of the custom script extension. + + String + + + TypeHandlerVersion + + Specifies the version of the extension to use for this virtual machine. To obtain the version, run the Get-AzureRmVMExtensionImage cmdlet with a value of Microsoft.Compute for the PublisherName parameter and VMAccessAgent for the Type parameter. + + String + + + ContainerName + + Specifies the name of the Azure Storage container where this cmdlet stores the script. + + String + + + FileName + + Specifies the name of the script file. + + String[] + + + StorageAccountName + + Specifies the name of the Azure Storage account where this cmdlet stores the script. + + String + + + StorageEndpointSuffix + + Specifies the storage endpoint suffix. + + String + + + StorageAccountKey + + Specifies the key for the Azure Storage container. + + String + + + Run + + Specifies the command to use that runs your script. + + String + + + Argument + + Specifies arguments that the script extension passes to the script. + + String + + + Location + + Specifies the location of the virtual machine. + + String + + + InformationAction + + + + ActionPreference + + + InformationVariable + + + + String + + + + Set-AzureRmVMCustomScriptExtension + + ResourceGroupName + + Specifies the name of the resource group of the virtual machine. + + String + + + VMName + + Specifies the name of a virtual machine. This cmdlet adds the custom script extension for the virtual machine that this parameter specifies. + + String + + + Name + + Specifies the name of the custom script extension. + + String + + + TypeHandlerVersion + + Specifies the version of the extension to use for this virtual machine. To obtain the version, run the Get-AzureRmVMExtensionImage cmdlet with a value of Microsoft.Compute for the PublisherName parameter and VMAccessAgent for the Type parameter. + + String + + + FileUri + + Specifies the URI of the script file. + + String[] + + + Run + + Specifies the command to use that runs your script. + + String + + + Argument + + Specifies arguments that the script extension passes to the script. + + String + + + Location + + Specifies the location of the virtual machine. + + String + + + InformationAction + + + + ActionPreference + + + InformationVariable + + + + String + + + + + + ResourceGroupName + + Specifies the name of the resource group of the virtual machine. + + String + + String + + + none + + + VMName + + Specifies the name of a virtual machine. This cmdlet adds the custom script extension for the virtual machine that this parameter specifies. + + String + + String + + + none + + + Name + + Specifies the name of the custom script extension. + + String + + String + + + none + + + TypeHandlerVersion + + Specifies the version of the extension to use for this virtual machine. To obtain the version, run the Get-AzureRmVMExtensionImage cmdlet with a value of Microsoft.Compute for the PublisherName parameter and VMAccessAgent for the Type parameter. + + String + + String + + + none + + + ContainerName + + Specifies the name of the Azure Storage container where this cmdlet stores the script. + + String + + String + + + none + + + FileName + + Specifies the name of the script file. + + String[] + + String[] + + + none + + + StorageAccountName + + Specifies the name of the Azure Storage account where this cmdlet stores the script. + + String + + String + + + none + + + StorageEndpointSuffix + + Specifies the storage endpoint suffix. + + String + + String + + + none + + + StorageAccountKey + + Specifies the key for the Azure Storage container. + + String + + String + + + none + + + Run + + Specifies the command to use that runs your script. + + String + + String + + + none + + + Argument + + Specifies arguments that the script extension passes to the script. + + String + + String + + + none + + + Location + + Specifies the location of the virtual machine. + + String + + String + + + none + + + InformationAction + + + + ActionPreference + + ActionPreference + + + + + + InformationVariable + + + + String + + String + + + + + + FileUri + + Specifies the URI of the script file. + + String[] + + String[] + + + none + + + Profile + + Specifies the Azure profile from which this cmdlet reads. If you do not specify a profile, this cmdlet reads from the local default profile. + + azureprofile + + azureprofile + + + none + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Keywords: azure, azurerm, arm, resource, management, manager, compute, vm, iaas + + + + + -------------------------- Example 1: Add a custom script -------------------------- + + PS C:\> + + PS C:\>Set-AzureRmVMCustomScriptExtension -ResourceGroupName "ResourceGroup11" -Location "Central US" -VMName "VirtualMachine07" -Name "contosotest" -TypeHandlerVersion "1.1" -StorageAccountName "contoso" -StorageAccountKey <StorageKey> -FileName "contososcript.exe" -ContainerName "scripts" + + This command adds a custom script to the virtual machine named VirtualMachine07. The script file is contososcript.exe. + + + + + + + + + + + + + + + + Get-AzureRmVMCustomScriptExtension + + + + Remove-AzureRmVMCustomScriptExtension + + + + + + + + Set-AzureRmVMDataDisk + + + + + + + Set + AzureRmVMDataDisk + + + + + + + + Set-AzureRmVMDataDisk + + VM + + + + PSVirtualMachine + + + Name + + + + String + + + Caching + + + + String + + + DiskSizeInGB + + + + Nullable`1[Int32] + + + InformationAction + + + + ActionPreference + + + InformationVariable + + + + String + + + + Set-AzureRmVMDataDisk + + VM + + + + PSVirtualMachine + + + Lun + + + + Nullable`1[Int32] + + + Caching + + + + String + + + DiskSizeInGB + + + + Nullable`1[Int32] + + + InformationAction + + + + ActionPreference + + + InformationVariable + + + + String + + + + + + VM + + + + PSVirtualMachine + + PSVirtualMachine + + + + + + Name + + + + String + + String + + + + + + Caching + + + + String + + String + + + + + + DiskSizeInGB + + + + Nullable`1[Int32] + + Nullable`1[Int32] + + + + + + InformationAction + + + + ActionPreference + + ActionPreference + + + + + + InformationVariable + + + + String + + String + + + + + + Lun + + + + Nullable`1[Int32] + + Nullable`1[Int32] + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Set-AzureRmVMDiagnosticsExtension + + + + + + + Set + AzureRmVMDiagnosticsExtension + + + + + + + + Set-AzureRmVMDiagnosticsExtension + + ResourceGroupName + + + + String + + + VMName + + + + String + + + DiagnosticsConfigurationPath + + + + String + + + StorageContext + + + + AzureStorageContext + + + Location + + + + String + + + Name + + + + String + + + InformationAction + + + + ActionPreference + + + InformationVariable + + + + String + + + + + + ResourceGroupName + + + + String + + String + + + + + + VMName + + + + String + + String + + + + + + DiagnosticsConfigurationPath + + + + String + + String + + + + + + StorageContext + + + + AzureStorageContext + + AzureStorageContext + + + + + + Location + + + + String + + String + + + + + + Name + + + + String + + String + + + + + + InformationAction + + + + ActionPreference + + ActionPreference + + + + + + InformationVariable + + + + String + + String + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Set-AzureRmVMDiskEncryptionExtension + + Set-AzureRmVMDiskEncryptionExtension cmdlet enables encryption on a running IaaS VM in Azure. This cmdlet prepares the VM to enable encryption, which may need rebooting the VM when done for the first time. This cmdlet installs an extension on the VM to enable encryption. If no Name parameter is specified, an extension with default name 'AzureDiskEncryption' for Windows VMs and 'AzureDiskEncryptionForLinux' for Linux VMs is created. Please save your work on the VM before running this cmdlet and wait for it to be done. + + + + + Set + AzureRmVMDiskEncryptionExtension + + + + + + + + Set-AzureRmVMDiskEncryptionExtension + + ResourceGroupName + + Resource group name of the virtual machine + + String + + + VMName + + Name of the virtual machine + + String + + + AadClientID + + Client ID of the Azure Active Directory application that has permissions to write secrets to KeyVault + + String + + + AadClientSecret + + Client secret of the Azure Active Directory application that has permissions to write secrets to KeyVault + + String + + + DiskEncryptionKeyVaultUrl + + KeyVault URL to which the VM encryption keys should be uploaded to. + + String + + + DiskEncryptionKeyVaultId + + Resource ID of the KeyVault to which the VM encryption keys should be uploaded to. + + String + + + KeyEncryptionKeyUrl + + URL of the key encryption key that is used to wrap and unwrap the VM encryption key. This must be the full versioned URL. See examples for more details. + + String + + + KeyEncryptionKeyVaultId + + Resource ID of the KeyVault containing key encryption key that is used to wrap and unwrap the VM encryption key. This must be the full versioned URL. See examples for more details. + + String + + + KeyEncryptionAlgorithm + + Algorithm used to wrap and unwrap the VM encryption key with key encryption key. Default value is RSA-OAEP if not specified. + + String + + + VolumeType + + Type of VM volumes to perform the encryption operation. For Windows VMs allowed values are All, OS and Data . For Linux VMs allowed value is Data only. Default for Windows VMs is All if not specified. + + String + + + SequenceVersion + + Sequence number of the encryption operations on a given VM. This should be unique per each encryption operation performed on the same VM. See examples on how to retrieve the previous sequence number supplied. + + String + + + TypeHandlerVersion + + Version of the encryption extension. By default the latest version of the extension is used if not provided. + + String + + + Name + + Name of the ARM resource that represents the extension. This is defaulted to 'AzureDiskEncryption' for Windows VMs and 'AzureDiskEncryptionForLinux' for Linux VMs. + + String + + + Passphrase + + Passphrase specified in the powershell. This parameter only works for Linux VM. + + String + + + Force + + Force switch performs the encryption operation without prompting for a confirmation + + SwitchParameter + + + InformationAction + + + + ActionPreference + + + InformationVariable + + + + String + + + + Set-AzureRmVMDiskEncryptionExtension + + ResourceGroupName + + Resource group name of the virtual machine + + String + + + VMName + + Name of the virtual machine + + String + + + AadClientID + + Client ID of the Azure Active Directory application that has permissions to write secrets to KeyVault + + String + + + AadClientCertThumbprint + + Thumbprint of the Azure Active Directory application client certificate that has permissions to write secrets to KeyVault. The certificate must be previously deployed on to the VM local machine My certificate store. + + String + + + DiskEncryptionKeyVaultUrl + + KeyVault URL to which the VM encryption keys should be uploaded to. + + String + + + DiskEncryptionKeyVaultId + + Resource ID of the KeyVault to which the VM encryption keys should be uploaded to. + + String + + + KeyEncryptionKeyUrl + + URL of the key encryption key that is used to wrap and unwrap the VM encryption key. This must be the full versioned URL. See examples for more details. + + String + + + KeyEncryptionKeyVaultId + + Resource ID of the KeyVault containing key encryption key that is used to wrap and unwrap the VM encryption key. This must be the full versioned URL. See examples for more details. + + String + + + KeyEncryptionAlgorithm + + Algorithm used to wrap and unwrap the VM encryption key with key encryption key. Default value is RSA-OAEP if not specified. + + String + + + VolumeType + + Type of VM volumes to perform the encryption operation. For Windows VMs allowed values are All, OS and Data . For Linux VMs allowed value is Data only. Default for Windows VMs is All if not specified. + + String + + + SequenceVersion + + Sequence number of the encryption operations on a given VM. This should be unique per each encryption operation performed on the same VM. See examples on how to retrieve the previous sequence number supplied. + + String + + + TypeHandlerVersion + + Version of the encryption extension. By default the latest version of the extension is used if not provided. + + String + + + Name + + Name of the ARM resource that represents the extension. This is defaulted to 'AzureDiskEncryption' for Windows VMs and 'AzureDiskEncryptionForLinux' for Linux VMs. + + String + + + Passphrase + + Passphrase specified in the powershell. This parameter only works for Linux VM. + + String + + + Force + + Force switch performs the encryption operation without prompting for a confirmation + + SwitchParameter + + + InformationAction + + + + ActionPreference + + + InformationVariable + + + + String + + + + + + ResourceGroupName + + Resource group name of the virtual machine + + String + + String + + + + + + VMName + + Name of the virtual machine + + String + + String + + + + + + AadClientID + + Client ID of the Azure Active Directory application that has permissions to write secrets to KeyVault + + String + + String + + + + + + AadClientSecret + + Client secret of the Azure Active Directory application that has permissions to write secrets to KeyVault + + String + + String + + + + + + DiskEncryptionKeyVaultUrl + + KeyVault URL to which the VM encryption keys should be uploaded to. + + String + + String + + + + + + DiskEncryptionKeyVaultId + + Resource ID of the KeyVault to which the VM encryption keys should be uploaded to. + + String + + String + + + + + + KeyEncryptionKeyUrl + + URL of the key encryption key that is used to wrap and unwrap the VM encryption key. This must be the full versioned URL. See examples for more details. + + String + + String + + + + + + KeyEncryptionKeyVaultId + + Resource ID of the KeyVault containing key encryption key that is used to wrap and unwrap the VM encryption key. This must be the full versioned URL. See examples for more details. + + String + + String + + + + + + KeyEncryptionAlgorithm + + Algorithm used to wrap and unwrap the VM encryption key with key encryption key. Default value is RSA-OAEP if not specified. + + String + + String + + + + + + VolumeType + + Type of VM volumes to perform the encryption operation. For Windows VMs allowed values are All, OS and Data . For Linux VMs allowed value is Data only. Default for Windows VMs is All if not specified. + + String + + String + + + + + + SequenceVersion + + Sequence number of the encryption operations on a given VM. This should be unique per each encryption operation performed on the same VM. See examples on how to retrieve the previous sequence number supplied. + + String + + String + + + + + + TypeHandlerVersion + + Version of the encryption extension. By default the latest version of the extension is used if not provided. + + String + + String + + + + + + Name + + Name of the ARM resource that represents the extension. This is defaulted to 'AzureDiskEncryption' for Windows VMs and 'AzureDiskEncryptionForLinux' for Linux VMs. + + String + + String + + + + + + Passphrase + + Passphrase specified in the powershell. This parameter only works for Linux VM. + + String + + String + + + + + + Force + + Force switch performs the encryption operation without prompting for a confirmation + + SwitchParameter + + SwitchParameter + + + + + + InformationAction + + + + ActionPreference + + ActionPreference + + + + + + InformationVariable + + + + String + + String + + + + + + AadClientCertThumbprint + + Thumbprint of the Azure Active Directory application client certificate that has permissions to write secrets to KeyVault. The certificate must be previously deployed on to the VM local machine My certificate store. + + String + + String + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + -------------------------- Enabling encryption using AAD Client ID, Client Secret -------------------------- + + PS C:\> + + $rgName = 'MyResourceGroup'; +$vmName = 'MyWindowsVM'; +$aadClientID = "<clientID of your AAD app>"; +$aadClientSecret = "<clientSecret of your AAD app>"; - - - This example script shows how to create a virtual machine. This script uses several other cmdlets. - - - - - - - - - - - - - Get-AzureRmVM - - - - Remove-AzureRmVM - - - - Restart-AzureRmVM - - - - Start-AzureRmVM - - - - Stop-AzureRmVM - - - - Update-AzureRmVM - - - - Add-AzureRmVMDataDisk - - - - Add-AzureRmVMNetworkInterface - - - - New-AzureRmVMConfig - - - - Set-AzureRmVMOperatingSystem - - - - Set-AzureRmVMSourceImage - - - - Set-AzureRmVMOSDisk - - - - - - Keywords: azure, azurerm, arm, resource, management, manager, compute, vm, iaas - - - - - - Remove-AzureRmAvailabilitySet - - Removes an availability set from Azure. - - - - - Remove - AzureAvailabilitySet - - - - The Remove-AzureRmAvailabilitySet cmdlet removes an availability set from Azure. - - - - Remove-AzureRmAvailabilitySet - - ResourceGroupName - - Specifies the name of a resource group. - - String - - - Name - - Specifies the name of the availability set to remove. - - String - - - Force - - Forces the command to run without asking for user confirmation. - - - - Profile - - Specifies the Azure profile from which this cmdlet reads. If you do not specify a profile, this cmdlet reads from the local default profile. - - AzureProfile - - - - - - Force - - Forces the command to run without asking for user confirmation. - - SwitchParameter - - SwitchParameter - - - none - - - Name - - Specifies the name of the availability set to remove. - - String - - String - - - none - - - Profile - - Specifies the Azure profile from which this cmdlet reads. If you do not specify a profile, this cmdlet reads from the local default profile. - - AzureProfile - - AzureProfile - - - none - - - ResourceGroupName - - Specifies the name of a resource group. - - String - - String - - - none - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Example 1: Remove an availability set - - - - - PS C:\>Remove-AzureRmAvailabilitySet -Name "AvailabilitySet03" -ResourceGroupName "ResourceGroup11" - - - This command removes an availability set named AvailablitySet03 in the resource group named ResourceGroup11. - - - - - - - - - - - - - Get-AzureRmAvailabilitySet - - - - New-AzureRmAvailabilitySet - - - - - - Keywords: azure, azurerm, arm, resource, management, manager, compute, vm, iaas - - - - - - Remove-AzureRmVMAccessExtension - - Removes the VMAccess extension from a virtual machine. - - - - - Remove - AzureVMAccessExtension - - - - The Remove-AzureRmVMAccessExtension cmdlet removes the Virtual Machine Access (VMAccess) Virtual Machine Extension from a virtual machine. - - - - Remove-AzureRmVMAccessExtension - - ResourceGroupName - - Specifies the name of the resource group of the virtual machine. - - String - - - VMName - - Specifies the name of a virtual machine. This cmdlet removes VMAccess for the virtual machine that this parameter specifies. - - String - - - Name - - Specifies the name of the extension that this cmdlet removes. - - String - - - Force - - Forces the command to run without asking for user confirmation. - - - - Profile - - Specifies the Azure profile from which this cmdlet reads. If you do not specify a profile, this cmdlet reads from the local default profile. - - AzureProfile - - - - - - Force - - Forces the command to run without asking for user confirmation. - - SwitchParameter - - SwitchParameter - - - none - - - Name - - Specifies the name of the extension that this cmdlet removes. - - String - - String - - - none - - - Profile - - Specifies the Azure profile from which this cmdlet reads. If you do not specify a profile, this cmdlet reads from the local default profile. - - AzureProfile - - AzureProfile - - - none - - - ResourceGroupName - - Specifies the name of the resource group of the virtual machine. - - String - - String - - - none - - - VMName - - Specifies the name of a virtual machine. This cmdlet removes VMAccess for the virtual machine that this parameter specifies. - - String - - String - - - none - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 1: - - - - - - - - - - - - - - - - - - Get-AzureRmVMAccessExtension - - - - Set-AzureRmVMAccessExtension - - - - Remove-AzureRmVMExtension - - - - - - Keywords: azure, azurerm, arm, resource, management, manager, compute, vm, iaas - - - - - - Remove-AzureRmVMCustomScriptExtension - - Removes a custom script extension from a virtual machine. - - - - - Remove - AzureVMCustomScriptExtension - - - - The Remove-AzureRmVMCustomScriptExtension cmdlet removes a custom script Virtual Machine Extension from a virtual machine. - - - - Remove-AzureRmVMCustomScriptExtension - - ResourceGroupName - - Specifies the name of the resource group of the virtual machine. - - String - - - VMName - - Specifies the name of a virtual machine from which this cmdlet removes the custom script extension. - - String - - - Name - - Specifies the name of the custom script extension that this cmdlet removes. - - String - - - Force - - Forces the command to run without asking for user confirmation. - - - - Profile - - Specifies the Azure profile from which this cmdlet reads. If you do not specify a profile, this cmdlet reads from the local default profile. - - AzureProfile - - - - - - Force - - Forces the command to run without asking for user confirmation. - - SwitchParameter - - SwitchParameter - - - none - - - Name - - Specifies the name of the custom script extension that this cmdlet removes. - - String - - String - - - none - - - Profile - - Specifies the Azure profile from which this cmdlet reads. If you do not specify a profile, this cmdlet reads from the local default profile. - - AzureProfile - - AzureProfile - - - none - - - ResourceGroupName - - Specifies the name of the resource group of the virtual machine. - - String - - String - - - none - - - VMName - - Specifies the name of a virtual machine from which this cmdlet removes the custom script extension. - - String - - String - - - none - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 1: - - - - - - - - - - - - - - - - - - Get-AzureRmVMCustomScriptExtension - - - - Set-AzureRmVMCustomScriptExtension - - - - - - Keywords: azure, azurerm, arm, resource, management, manager, compute, vm, iaas - - - - - - Remove-AzureRmVMDataDisk - - Removes a data disk from a virtual machine. - - - - - Remove - AzureVMDataDisk - - - - The Remove-AzureRmVMDataDisk cmdlet removes a data disk from a virtual machine. - - - - Remove-AzureRmVMDataDisk - - VM - - Specifies the local virtual machine object from which to remove a data disk. To obtain a virtual machine object, use the Get-AzureRmVM cmdlet. - - PSVirtualMachine - - - Name - - Specifies the name of the data disk to add. - - String - - - Profile - - Specifies the Azure profile from which this cmdlet reads. If you do not specify a profile, this cmdlet reads from the local default profile. - - AzureProfile - - - - - - Name - - Specifies the name of the data disk to add. - - String - - String - - - none - - - Profile - - Specifies the Azure profile from which this cmdlet reads. If you do not specify a profile, this cmdlet reads from the local default profile. - - AzureProfile - - AzureProfile - - - none - - - VM - - Specifies the local virtual machine object from which to remove a data disk. To obtain a virtual machine object, use the Get-AzureRmVM cmdlet. - - PSVirtualMachine - - PSVirtualMachine - - - none - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Example 1: Remove a data disk from a virtual machine - - - - - PS C:\>$VirtualMachine = Get-AzureRmVM -ResourceGroupName "ResourceGroup11" -Name "VirtualMachine07" -PS C:\> Remove-AzureRmVMDataDisk -VM $VirtualMachine -Name "disk3" -PS C:\> Update-AzureRmVM -ResourceGroupName "ResourceGroup11" -Name "VirtualMachine07" -VM $VirtualMachine - - - The first command gets the virtual machine named VirtualMachine07 by using the Get-AzureRmVM cmdlet. The command stores the virtual machine in the $VirtualMachine variable. - The second command removes the data disk named disk3 from the virtual machine stored in $VirtualMachine. - The final command updates the state of the virtual machine stored in $VirtualMachine in ResourceGroup11. - - - - - - - - - - - - - Add-AzureRmVMDataDisk - - - - Get-AzureRmVM - - - - - - Keywords: azure, azurerm, arm, resource, management, manager, compute, vm, iaas - - - - - - Remove-AzureRmVMExtension - - Removes an extension from a virtual machine. - - - - - Remove - AzureVMExtension - - - - The Remove-AzureRmVMExtension cmdlet removes an extension from the Virtual Machine Extensions of a virtual machine. - - - - Remove-AzureRmVMExtension - - ResourceGroupName - - Specifies the name of a resource group. - - String - - - VMName - - Specifies the name of a virtual machine. This cmdlet removes extensions from the virtual machine that this parameter specifies. - - String - - - Name - - Specifies the name of the extension to remove. - - String - - - Force - - Forces the command to run without asking for user confirmation. - - - - Profile - - Specifies the Azure profile from which this cmdlet reads. If you do not specify a profile, this cmdlet reads from the local default profile. - - AzureProfile - - - - - - Force - - Forces the command to run without asking for user confirmation. - - SwitchParameter - - SwitchParameter - - - none - - - Name - - Specifies the name of the extension to remove. - - String - - String - - - none - - - Profile - - Specifies the Azure profile from which this cmdlet reads. If you do not specify a profile, this cmdlet reads from the local default profile. - - AzureProfile - - AzureProfile - - - none - - - ResourceGroupName - - Specifies the name of a resource group. - - String - - String - - - none - - - VMName - - Specifies the name of a virtual machine. This cmdlet removes extensions from the virtual machine that this parameter specifies. - - String - - String - - - none - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Example 1: Remove an extension from a virtual machine - - - - - PS C:\>Remove-AzureRmVMExtension -ResourceGroupName "ResourceGroup11" -Name "ContosoTest" -VMName "VirtualMachine22" - - - This command removes the extension named ContosoTest from the virtual machine named VirtualMachine22 in ResourceGroup11. - - - - - - - - - - - - - Get-AzureRmVMExtension - - - - Set-AzureRmVMExtension - - - - - - Keywords: azure, azurerm, arm, resource, management, manager, compute, vm, iaas - - - - - - Remove-AzureRmVMNetworkInterface - - Removes a network interface from a virtual machine. - - - - - Remove - AzureVMNetworkInterface - - - - The Remove-AzureRmVMNetworkInterface cmdlet removes a network interface from a virtual machine. - - - - Remove-AzureRmVMNetworkInterface - - VM - - Specifies the virtual machine from which this cmdlet removes a network interface. To obtain a virtual machine object, use the Get-AzureRmVM cmdlet. - - PSVirtualMachine - - - Id - - Specifies the ID of the network interface that this cmdlet removes from the virtual machine. - - String - - - Profile - - Specifies the Azure profile from which this cmdlet reads. If you do not specify a profile, this cmdlet reads from the local default profile. - - AzureProfile - - - - - - Id - - Specifies the ID of the network interface that this cmdlet removes from the virtual machine. - - String - - String - - - none - - - Profile - - Specifies the Azure profile from which this cmdlet reads. If you do not specify a profile, this cmdlet reads from the local default profile. - - AzureProfile - - AzureProfile - - - none - - - VM - - Specifies the virtual machine from which this cmdlet removes a network interface. To obtain a virtual machine object, use the Get-AzureRmVM cmdlet. - - PSVirtualMachine - - PSVirtualMachine - - - none - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 1: - - - - - - - - - - - - - - - - - - Get-AzureRmVM - - - - - - Keywords: azure, azurerm, arm, resource, management, manager, compute, vm, iaas - - - - - - Remove-AzureRmVM - - Removes a virtual machine from Azure. - - - - - Remove - AzureVM - - - - The Remove-AzureRmVM cmdlet removes a virtual machine from Azure. - - - - Remove-AzureRmVM - - ResourceGroupName - - Specifies the name of a resource group. - - String - - - Name - - Specifies the name of the virtual machine to remove. - - String - - - Force - - Forces the command to run without asking for user confirmation. - - - - Profile - - Specifies the Azure profile from which this cmdlet reads. If you do not specify a profile, this cmdlet reads from the local default profile. - - AzureProfile - - - - - - Force - - Forces the command to run without asking for user confirmation. - - SwitchParameter - - SwitchParameter - - - none - - - Name - - Specifies the name of the virtual machine to remove. - - String - - String - - - none - - - Profile - - Specifies the Azure profile from which this cmdlet reads. If you do not specify a profile, this cmdlet reads from the local default profile. - - AzureProfile - - AzureProfile - - - none - - - ResourceGroupName - - Specifies the name of a resource group. - - String - - String - - - none - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Example 1: Remove a virtual machine - - - - - PS C:\>Remove-AzureRmVM -ResourceGroupName "ResourceGroup11" -Name "VirtualMachine07" - - - This command removes the virtual machine named VirtualMachine07 in the resource group ResourceGroup11. - - - - - - - - - - - - - Get-AzureRmVM - - - - New-AzureRmVM - - - - Restart-AzureRmVM - - - - Start-AzureRmVM - - - - Stop-AzureRmVM - - - - Update-AzureRmVM - - - - - - Keywords: azure, azurerm, arm, resource, management, manager, compute, vm, iaas - - - - - - Restart-AzureRmVM - - Restarts an Azure virtual machine. - - - - - Restart - AzureVM - - - - The Restart-AzureRmVM cmdlet restarts an Azure virtual machine. - - - - Restart-AzureRmVM - - ResourceGroupName - - Specifies the name of the resource group. - - String - - - Name - - Specifies the name of the virtual machine to restart. - - String - - - Profile - - Specifies the Azure profile from which this cmdlet reads. If you do not specify a profile, this cmdlet reads from the local default profile. - - AzureProfile - - - - - - Name - - Specifies the name of the virtual machine to restart. - - String - - String - - - none - - - Profile - - Specifies the Azure profile from which this cmdlet reads. If you do not specify a profile, this cmdlet reads from the local default profile. - - AzureProfile - - AzureProfile - - - none - - - ResourceGroupName - - Specifies the name of the resource group. - - String - - String - - - none - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Example 1: Restart a virtual machine - - - - - PS C:\>Restart-AzureRmVM -ResourceGroupName "ResourceGroup11" -Name "VirtualMachine07" - - - This command restarts the virtual machine named VirtualMachine07 in ResourceGroup11. - - - - - - - - - - - - - Get-AzureRmVM - - - - New-AzureRmVM - - - - Remove-AzureRmVM - - - - Start-AzureRmVM - - - - Stop-AzureRmVM - - - - Update-AzureRmVM - - - - - - Keywords: azure, azurerm, arm, resource, management, manager, compute, vm, iaas - - - - - - Save-AzureRmVMImage - - Captures a virtual machine as a VMImage. - - - - - Save - AzureVMImage - - - - The Save-AzureRmVMImage cmdlet captures a virtual machine as a VMImage. Before you create a virtual machine image, sysprep the virtual machine, and then mark it as generalized by using the Set-AzureRmVM cmdlet. - The output of this cmdlet is a JavaScript Object Notation (JSON) template. You can deploy virtual machines from your captured image. - - - - Save-AzureRmVMImage - - ResourceGroupName - - Specifies the name of the resource group of the virtual machine. - - String - - - VMName - - Specifies the name of the virtual machine that this cmdlet saves. - - String - - - DestinationContainerName - - Specifies the name of a container. The virtual hard disks (VHDs) that constitute the VMImage reside in the container that this parameter specifies. If the VHDs are spread across multiple storage accounts, this cmdlet creates one container that has this name in each storage account. - - String - - - VHDNamePrefix - - Specifies the prefix in the name of the blobs that constitute the storage profile of the VMImage. For example, a prefix vhdPrefix for operating system disk results in the name vhdPrefix-osdisk. - - String - - - Overwrite - - Indicates that this cmdlet overwrites any VHDs that have the same prefix in the destination container. - - - - Profile - - Specifies the Azure profile from which this cmdlet reads. If you do not specify a profile, this cmdlet reads from the local default profile. - - AzureProfile - - - - - - DestinationContainerName - - Specifies the name of a container. The virtual hard disks (VHDs) that constitute the VMImage reside in the container that this parameter specifies. If the VHDs are spread across multiple storage accounts, this cmdlet creates one container that has this name in each storage account. - - String - - String - - - none - - - Overwrite - - Indicates that this cmdlet overwrites any VHDs that have the same prefix in the destination container. - - SwitchParameter - - SwitchParameter - - - none - - - Profile - - Specifies the Azure profile from which this cmdlet reads. If you do not specify a profile, this cmdlet reads from the local default profile. - - AzureProfile - - AzureProfile - - - none - - - ResourceGroupName - - Specifies the name of the resource group of the virtual machine. - - String - - String - - - none - - - VHDNamePrefix - - Specifies the prefix in the name of the blobs that constitute the storage profile of the VMImage. For example, a prefix vhdPrefix for operating system disk results in the name vhdPrefix-osdisk. - - String - - String - - - none - - - VMName - - Specifies the name of the virtual machine that this cmdlet saves. - - String - - String - - - none - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Example 1: Capture a virtual machine - - - - - PS C:\>Set-AzureRmVM -ResourceGroupName "ResourceGroup11" -Name "VirtualMachine07" -Generalized -PS C:\> Save-AzureRmVMImage -ResourceGroupName "ResourceGroup11" -VMName "VirtualMachine07" -DestinationContainerName "VMContainer01" -VHDNamePrefix "VM07" - - - The first marks the virtual machine named VirtualMachine07 as generalized. - The second command captures a virtual machine named VirtualMachine07 as a VMImage. The Output property returns a JSON template. - - - - - - - - - - - - - Get-AzureRmVMImage - - - - Get-AzureRmVMImageOffer - - - - Get-AzureRmVMImagePublisher - - - - Get-AzureRmVMImageSku - - - - Set-AzureRmVM - - - - - - Keywords: azure, azurerm, arm, resource, management, manager, compute, vm, iaas - - - - - - Set-AzureRmVMAccessExtension - - Adds the VMAccess extension to a virtual machine. - - - - - Set - AzureVMAccessExtension - - - - The Set-AzureRmVMAccessExtension cmdlet adds the Virtual Machine Access (VMAccess) Virtual Machine Extension to a virtual machine. VMAccess can reset the virtual machine user name and password. - - - - Set-AzureRmVMAccessExtension - - ResourceGroupName - - Specifies the name of the resource group of the virtual machine. - - String - - - VMName - - Specifies the name of a virtual machine. This cmdlet adds VMAccess for the virtual machine that this parameter specifies. - - String - - - Name - - Specifies the name of the extension that this cmdlet adds. - - String - - - TypeHandlerVersion - - Specifies the version of the extension to use for this virtual machine. To obtain the version, run the Get-AzureRmVMExtensionImage cmdlet with a value of Microsoft.Compute for the PublisherName parameter and VMAccessAgent for the Type parameter. - - String - - - UserName - - Specifies the new user name for the virtual machine. - - String - - - Password - - Specifies the new password of the virtual machine. - - String - - - Location - - Specifies the location of the virtual machine. - - String - - - Profile - - Specifies the Azure profile from which this cmdlet reads. If you do not specify a profile, this cmdlet reads from the local default profile. - - AzureProfile - - - - - - Location - - Specifies the location of the virtual machine. - - String - - String - - - none - - - Name - - Specifies the name of the extension that this cmdlet adds. - - String - - String - - - none - - - Password - - Specifies the new password of the virtual machine. - - String - - String - - - none - - - Profile - - Specifies the Azure profile from which this cmdlet reads. If you do not specify a profile, this cmdlet reads from the local default profile. - - AzureProfile - - AzureProfile - - - none - - - ResourceGroupName - - Specifies the name of the resource group of the virtual machine. - - String - - String - - - none - - - TypeHandlerVersion - - Specifies the version of the extension to use for this virtual machine. To obtain the version, run the Get-AzureRmVMExtensionImage cmdlet with a value of Microsoft.Compute for the PublisherName parameter and VMAccessAgent for the Type parameter. - - String - - String - - - none - - - UserName - - Specifies the new user name for the virtual machine. - - String - - String - - - none - - - VMName - - Specifies the name of a virtual machine. This cmdlet adds VMAccess for the virtual machine that this parameter specifies. - - String - - String - - - none - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Example 1: Add a VMAccess extension - - - - - PS C:\> Set-AzureRmVMAccessExtension -ResourceGroupName "ResrouceGroup11" -Location "Central US" -VMName "VirtualMachine07" -Name "ContosoTest" -TypeHandlerVersion "2.0" -UserName "PFuller" -Password "Password" - - - This command adds a VMAccess extension for the virtual machine named VirtualMachine07 in ResrouceGroup11. The command specifies the name and type handler version for VMAccess. - - - - - - - - - - - - - Get-AzureRmVMAccessExtension - - - - Remove-AzureRmVMAccessExtension - - - - Set-AzureRmVMExtension - - - - Get-AzureRmVMExtensionImage - - - - - - Keywords: azure, azurerm, arm, resource, management, manager, compute, vm, iaas - - - - - - Set-AzureRmVMCustomScriptExtension - - Adds a custom script extension to a virtual machine. - - - - - Set - AzureVMCustomScriptExtension - - - - The Set-AzureRmVMCustomScriptExtension cmdlet adds a custom script Virtual Machine Extension to a virtual machine. This extension allows you to run your own scripts on the virtual machine. - - - - Set-AzureRmVMCustomScriptExtension - - ResourceGroupName - - Specifies the name of the resource group of the virtual machine. - - String - - - Run - - Specifies the command to use that runs your script. - - String - - - Argument - - Specifies arguments that the script extension passes to the script. - - String - - - Location - - Specifies the location of the virtual machine. - - String - - - VMName - - Specifies the name of a virtual machine. This cmdlet adds the custom script extension for the virtual machine that this parameter specifies. - - String - - - Name - - Specifies the name of the custom script extension. - - String - - - TypeHandlerVersion - - Specifies the version of the extension to use for this virtual machine. To obtain the version, run the Get-AzureRmVMExtensionImage cmdlet with a value of Microsoft.Compute for the PublisherName parameter and VMAccessAgent for the Type parameter. - - String - - - ContainerName - - Specifies the name of the Azure Storage container where this cmdlet stores the script. - - String - - - FileName - - Specifies the name of the script file. - - String[] - - - StorageAccountName - - Specifies the name of the Azure Storage account where this cmdlet stores the script. - - String - - - StorageEndpointSuffix - - Specifies the storage endpoint suffix. - - String - - - StorageAccountKey - - Specifies the key for the Azure Storage container. - - String - - - Profile - - Specifies the Azure profile from which this cmdlet reads. If you do not specify a profile, this cmdlet reads from the local default profile. - - AzureProfile - - - - Set-AzureRmVMCustomScriptExtension - - ResourceGroupName - - Specifies the name of the resource group of the virtual machine. - - String - - - Location - - Specifies the location of the virtual machine. - - String - - - VMName - - Specifies the name of a virtual machine. This cmdlet adds the custom script extension for the virtual machine that this parameter specifies. - - String - - - Name - - Specifies the name of the custom script extension. - - String - - - TypeHandlerVersion - - Specifies the version of the extension to use for this virtual machine. To obtain the version, run the Get-AzureRmVMExtensionImage cmdlet with a value of Microsoft.Compute for the PublisherName parameter and VMAccessAgent for the Type parameter. - - String - - - FileUri - - Specifies the URI of the script file. - - String[] - - - Run - - Specifies the command to use that runs your script. - - String - - - Argument - - Specifies arguments that the script extension passes to the script. - - String - - - Profile - - Specifies the Azure profile from which this cmdlet reads. If you do not specify a profile, this cmdlet reads from the local default profile. - - AzureProfile - - - - - - Argument - - Specifies arguments that the script extension passes to the script. - - String - - String - - - none - - - ContainerName - - Specifies the name of the Azure Storage container where this cmdlet stores the script. - - String - - String - - - none - - - FileName - - Specifies the name of the script file. - - String[] - - String[] - - - none - - - FileUri - - Specifies the URI of the script file. - - String[] - - String[] - - - none - - - Location - - Specifies the location of the virtual machine. - - String - - String - - - none - - - Name - - Specifies the name of the custom script extension. - - String - - String - - - none - - - Profile - - Specifies the Azure profile from which this cmdlet reads. If you do not specify a profile, this cmdlet reads from the local default profile. - - AzureProfile - - AzureProfile - - - none - - - ResourceGroupName - - Specifies the name of the resource group of the virtual machine. - - String - - String - - - none - - - Run - - Specifies the command to use that runs your script. - - String - - String - - - none - - - StorageAccountKey - - Specifies the key for the Azure Storage container. - - String - - String - - - none - - - StorageAccountName - - Specifies the name of the Azure Storage account where this cmdlet stores the script. - - String - - String - - - none - - - StorageEndpointSuffix - - Specifies the storage endpoint suffix. - - String - - String - - - none - - - TypeHandlerVersion - - Specifies the version of the extension to use for this virtual machine. To obtain the version, run the Get-AzureRmVMExtensionImage cmdlet with a value of Microsoft.Compute for the PublisherName parameter and VMAccessAgent for the Type parameter. - - String - - String - - - none - - - VMName - - Specifies the name of a virtual machine. This cmdlet adds the custom script extension for the virtual machine that this parameter specifies. - - String - - String - - - none - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Example 1: Add a custom script - - - - - PS C:\>Set-AzureRmVMCustomScriptExtension -ResourceGroupName "ResourceGroup11" -Location "Central US" -VMName "VirtualMachine07" -Name "contosotest" -TypeHandlerVersion "1.1" -StorageAccountName "contoso" -StorageAccountKey <StorageKey> -FileName "contososcript.exe" -ContainerName "scripts" - - - This command adds a custom script to the virtual machine named VirtualMachine07. The script file is contososcript.exe. - - - - - - - - - - - - - Get-AzureRmVMCustomScriptExtension - - - - Remove-AzureRmVMCustomScriptExtension - - - - - - Keywords: azure, azurerm, arm, resource, management, manager, compute, vm, iaas - - - - - - Set-AzureRmVMExtension - - Updates extension properties or adds an extension to a virtual machine. - - - - - Set - AzureVMExtension - - - - The Set-AzureRmVMExtension cmdlet updates properties for existing Virtual Machine Extensions or adds an extension to a virtual machine. - - - - Set-AzureRmVMExtension - - ResourceGroupName - - Specifies the name of a resource group. - - String - - - VMName - - Specifies the name of a virtual machine. This cmdlet modifies extensions for the virtual machine that this parameter specifies. - - String - - - Name - - Specifies the name of an extension. - - String - - - Publisher - - Specifies the name of the extension publisher. The publisher provides a name when the publisher registers an extension. - - String - - - ExtensionType - - Specifies the extension type. - - System.String - - - TypeHandlerVersion - - Specifies the version of the extension to use for this virtual machine. - - String - - - Settings - - Specifies public configuration for the extension, as a hash table. This cmdlet does not encrypt public configuration. - - Hashtable - - - ProtectedSettings - - Specifies private configuration for the extension, as a hash table. This cmdlet encrypts the private configuration. - - Hashtable - - - Location - - Specifies the location of the virtual machine. - - String - - - Profile - - Specifies the Azure profile from which this cmdlet reads. If you do not specify a profile, this cmdlet reads from the local default profile. - - AzureProfile - - - - Set-AzureRmVMExtension - - ResourceGroupName - - Specifies the name of a resource group. - - String - - - VMName - - Specifies the name of a virtual machine. This cmdlet modifies extensions for the virtual machine that this parameter specifies. - - String - - - Name - - Specifies the name of an extension. - - String - - - Publisher - - Specifies the name of the extension publisher. The publisher provides a name when the publisher registers an extension. - - String - - - ExtensionType - - Specifies the extension type. - - System.String - - - TypeHandlerVersion - - Specifies the version of the extension to use for this virtual machine. - - String - - - SettingString - - Specifies public configuration for the extension, as a string. This cmdlet does not encrypt public configuration. - - String - - - ProtectedSettingString - - Specifies private configuration for the extension, as a string. This cmdlet encrypts the private configuration. - - String - - - Location - - Specifies the location of the virtual machine. - - String - - - Profile - - Specifies the Azure profile from which this cmdlet reads. If you do not specify a profile, this cmdlet reads from the local default profile. - - AzureProfile - - - - - - ExtensionType - - Specifies the extension type. - - System.String - - System.String - - - none - - - Location - - Specifies the location of the virtual machine. - - String - - String - - - none - - - Name - - Specifies the name of an extension. - - String - - String - - - none - - - Profile - - Specifies the Azure profile from which this cmdlet reads. If you do not specify a profile, this cmdlet reads from the local default profile. - - AzureProfile - - AzureProfile - - - none - - - ProtectedSettings - - Specifies private configuration for the extension, as a hash table. This cmdlet encrypts the private configuration. - - Hashtable - - Hashtable - - - none - - - ProtectedSettingString - - Specifies private configuration for the extension, as a string. This cmdlet encrypts the private configuration. - - String - - String - - - none - - - Publisher - - Specifies the name of the extension publisher. The publisher provides a name when the publisher registers an extension. - - String - - String - - - none - - - ResourceGroupName - - Specifies the name of a resource group. - - String - - String - - - none - - - Settings - - Specifies public configuration for the extension, as a hash table. This cmdlet does not encrypt public configuration. - - Hashtable - - Hashtable - - - none - - - SettingString - - Specifies public configuration for the extension, as a string. This cmdlet does not encrypt public configuration. - - String - - String - - - none - - - TypeHandlerVersion - - Specifies the version of the extension to use for this virtual machine. - - String - - String - - - none - - - VMName - - Specifies the name of a virtual machine. This cmdlet modifies extensions for the virtual machine that this parameter specifies. - - String - - String - - - none - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Example 1: Modify settings by using hash tables - - - - - PS C:\>$Settings = @{"fileUris" = "[]"; "commandToExecute" = ""}; -PS C:\> $ProtectedSettings = @{"storageAccountName" = $stoname; "storageAccountKey" = $stokey}; -PS C:\> Set-AzureRmVMExtension -ResourceGroupName "ResourceGroup11" -Location "West US" -VMName "VirtualMachine22" -Name "ContosoTest" -Publisher "Contoso.Compute" -Type "CustomScriptExtension" -TypeHandlerVersion "1.1" -Settings $Settings -ProtectedSettings $ProtectedSettings; - - - The first two commands use standard Windows PowerShell® syntax to create hash tables, and then stores those hash tables in the $Settings and $ProtectedSettings variables. For more information, type Get-Help about_Hash_Tables. The second command includes two values previously created and stored in variables. - The final command modifies an extension of the virtual machine named VirtualMachine22 in ResourceGroup11 according to the contents of $Settings and $ProtectedSettings. The command specifies other required information that includes the publisher and the extension type. - - - - - - - - - - - Example 2: Modify settings by using strings - - - - - PS C:\>$SettingsString = '{"fileUris":[],"commandToExecute":""}'; -PS C:\> $ProtectedSettingsString = '{"storageAccountName":"' + $stoname + '","storageAccountKey":"' + $stokey + '"}'; -PS C:\> Set-AzureRmVMExtension -ResourceGroupName "ResourceGroup11" -Location "West US" -VMName "VirtualMachine22" -Name "CustomScriptExtension" -Publisher "Contoso.Compute" -Type "CustomScriptExtension" -TypeHandlerVersion "1.1" -SettingString $SettingsString -ProtectedSettingString $ProtectedSettingsString ; - - - The first two commands create strings that contain settings, and then stores them in the $SettingsString and $ProtectedSettingsString variables. - The final command modifies an extension of the virtual machine named VirtualMachine22 in ResourceGroup11 according to the contents of $SettingsString and $ProtectedSettingsString. The command specifies other required information that includes the publisher and the extension type. - - - - - - - - - - - - - Get-AzureRmVMExtension - - - - Remove-AzureRmVMExtension - - - - - - Keywords: azure, azurerm, arm, resource, management, manager, compute, vm, iaas - - - - - - Set-AzureRmVMOperatingSystem - - Sets operating system properties for a virtual machine. - - - - - Set - AzureVMOperatingSystem - - - - The Set-AzureRmVMOperatingSystem cmdlet sets operating system properties for a virtual machine. You can specify logon credentials computer name, and operating system type. - - - - Set-AzureRmVMOperatingSystem - - VM - - Specifies the local virtual machine object on which to set operating system properties. To obtain a virtual machine object, use the Get-AzureRmVM cmdlet. Create a virtual machine object by using the New-AzureRmVMConfig cmdlet. - - PSVirtualMachine - - - WinRMHttps - - Indicates that this operating system uses HTTPS WinRM. - - - - WinRMCertificateUrl - - Specifies the URI of a WinRM certificate. This needs to be stored in a Key Vault. - - System.Uri - - - Windows - - Indicates that the type of operating system is Windows. - - - - ComputerName - - Specifies the name of the computer. - - String - - - Credential - - Specifies the user name and password for the virtual machine as a PSCredential object. To obtain a credential, use the Get-Credential cmdlet. For more information, type Get-Help Get-Credential. - - PSCredential - - - CustomData - - Specifies a base-64 encoded string of custom data. This is decoded to a binary array that is saved as a file on the virtual machine. The maximum length of the binary array is 65535 bytes. - - System.String - - - ProvisionVMAgent - - Indicates that the settings require that the virtual machine agent be installed on the virtual machine. - - - - EnableAutoUpdate - - Indicates that this cmdlet enables auto update. - - - - TimeZone - - Specifies the time zone for the virtual machine. - - System.String - - - WinRMHttp - - Indicates that this operating system uses HTTP WinRM. - - - - Profile - - Specifies the Azure profile from which this cmdlet reads. If you do not specify a profile, this cmdlet reads from the local default profile. - - AzureProfile - - - - Set-AzureRmVMOperatingSystem - - VM - - Specifies the local virtual machine object on which to set operating system properties. To obtain a virtual machine object, use the Get-AzureRmVM cmdlet. Create a virtual machine object by using the New-AzureRmVMConfig cmdlet. - - PSVirtualMachine - - - Linux - - Indicates that the type of operating system is Linux. - - - - ComputerName - - Specifies the name of the computer. - - String - - - Credential - - Specifies the user name and password for the virtual machine as a PSCredential object. To obtain a credential, use the Get-Credential cmdlet. For more information, type Get-Help Get-Credential. - - PSCredential - - - CustomData - - Specifies a base-64 encoded string of custom data. This is decoded to a binary array that is saved as a file on the virtual machine. The maximum length of the binary array is 65535 bytes. - - System.String - - - DisablePasswordAuthentication - - Indicates that this cmdlet disables password authentication. - - - - Profile - - Specifies the Azure profile from which this cmdlet reads. If you do not specify a profile, this cmdlet reads from the local default profile. - - AzureProfile - - - - - - ComputerName - - Specifies the name of the computer. - - String - - String - - - none - - - Credential - - Specifies the user name and password for the virtual machine as a PSCredential object. To obtain a credential, use the Get-Credential cmdlet. For more information, type Get-Help Get-Credential. - - PSCredential - - PSCredential - - - none - - - CustomData - - Specifies a base-64 encoded string of custom data. This is decoded to a binary array that is saved as a file on the virtual machine. The maximum length of the binary array is 65535 bytes. - - System.String - - System.String - - - none - - - DisablePasswordAuthentication - - Indicates that this cmdlet disables password authentication. - - SwitchParameter - - SwitchParameter - - - none - - - EnableAutoUpdate - - Indicates that this cmdlet enables auto update. - - SwitchParameter - - SwitchParameter - - - none - - - Linux - - Indicates that the type of operating system is Linux. - - SwitchParameter - - SwitchParameter - - - none - - - Profile - - Specifies the Azure profile from which this cmdlet reads. If you do not specify a profile, this cmdlet reads from the local default profile. - - AzureProfile - - AzureProfile - - - none - - - ProvisionVMAgent - - Indicates that the settings require that the virtual machine agent be installed on the virtual machine. - - SwitchParameter - - SwitchParameter - - - none - - - TimeZone - - Specifies the time zone for the virtual machine. - - System.String - - System.String - - - none - - - VM - - Specifies the local virtual machine object on which to set operating system properties. To obtain a virtual machine object, use the Get-AzureRmVM cmdlet. Create a virtual machine object by using the New-AzureRmVMConfig cmdlet. - - PSVirtualMachine - - PSVirtualMachine - - - none - - - Windows - - Indicates that the type of operating system is Windows. - - SwitchParameter - - SwitchParameter - - - none - - - WinRMCertificateUrl - - Specifies the URI of a WinRM certificate. This needs to be stored in a Key Vault. - - System.Uri - - System.Uri - - - none - - - WinRMHttp - - Indicates that this operating system uses HTTP WinRM. - - SwitchParameter - - SwitchParameter - - - none - - - WinRMHttps - - Indicates that this operating system uses HTTPS WinRM. - - SwitchParameter - - SwitchParameter - - - none - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Example 1: Set operating system properties for a new virtual machines - - - - - PS C:\>$SecurePassword = ConvertTo-SecureString "password" -AsPlainText -Force -PS C:\> $Credential = New-Object System.Management.Automation.PSCredential ("FullerP", $SecurePassword); -PS C:\> $AvailabilitySet = Get-AzureRmAvailabilitySet -ResourceGroupName "ResourceGroup11" -Name "AvailabilitySet03" -PS C:\> $VirtualMachine = New-AzureRmVMConfig -VMName "VirtualMachine07" -VMSize "Standard_A1" -AvailabilitySetID $AvailabilitySet.Id -PS C:\> $ComputerName = "ContosoVM122" -PS C:\> $WinRMCertUrl = "http://keyVaultName.vault.azure.net/secrets/secretName/secretVersion" -PS C:\> $TimeZone = "Pacific Standard Time" -PS C:\> $CustomData = "echo 'Hello World'" -PS C:\> $VirtualMachine = Set-AzureRmVMOperatingSystem -VM $$VirtualMachine -Windows -ComputerName $ComputerName -Credential $Credential -CustomData $CustomData -WinRMHttp -WinRMHttps -WinRMCertificateUrl $WinRMCertUrl -ProvisionVMAgent -EnableAutoUpdate -TimeZone $TimeZone - - - The first command converts a password to a secure string, and then stores it in the $SecurePassword variable. For more information, type Get-Help ConvertTo-SecureString. - The second command creates a credential for the user FullerP and the password stored in $SecurePassword, and then stores the credential in the $Credential variable. For more information, type Get-Help New-Object. - The third command gets the availability set named AvailablitySet03 in the resource group named ResourceGroup11, and then stores that object in the $AvailabilitySet variable. - The fourth command creates a virtual machine object, and then stores it in the $VirtualMachine variable. The command assigns a name and size to the virtual machine. The virtual machine belongs to the availability set stored in $AvailabilitySet. - The next four commands assign values to variables to use in the following command. Because you could specify these strings directly in the Set-AzureRmVMOperatingSystem command, this approach is used only for readability. However, you might use an approach such as this in scripts. - The final command sets operating system properties for the virtual machine stored in $VirtualMachine. The command uses the credentials stored in $Credential. The command uses variables assigned in previous commands for some parameters. - - - - - - - - - - - - - Get-AzureRmVM - - - - New-AzureRmVMConfig - - - - - - Keywords: azure, azurerm, arm, resource, management, manager, compute, vm, iaas - - - - - - Set-AzureRmVMOSDisk - - Sets the operating system disk properties on a virtual machine. - - - - - Set - AzureVMOSDisk - - - - The Set-AzureRmVMOSDisk cmdlet set the operating system disk properties on a virtual machine. - - - - Set-AzureRmVMOSDisk - - VM - - Specifies the local virtual machine object on which to set operating system disk properties. To obtain a virtual machine object, use the Get-AzureRmVM cmdlet. - - PSVirtualMachine - - - Name - - Specifies the name of the operating system disk. - - String - - - VhdUri - - Specifies the Uniform Resource Identifier (URI) of a virtual hard disk (VHD). - For an image based virtual machine, this parameter specifies the VHD file to create when a platform image or user image is specified. This is the location from which the image binary large object (BLOB) is copied to start the virtual machine. - For a disk based virtual machine boot scenario, this parameter specifies the VHD file that the virtual machine uses directly for starting up. - - String - - - Caching - - Specifies the caching mode of the operating system disk. Valid values are: +$vaultName= 'MyKeyVault'; +$keyVault = Get-AzureRmKeyVault -VaultName $vaultName -ResourceGroupName $rgname; +$diskEncryptionKeyVaultUrl = $keyVault.VaultUri; +$keyVaultResourceId = $keyVault.ResourceId; --- ReadOnly --- ReadWrite +Set-AzureRmVMDiskEncryptionExtension -ResourceGroupName $rgname -VMName $vmName -AadClientID $aadClientID -AadClientSecret $aadClientSecret -DiskEncryptionKeyVaultUrl $diskEncryptionKeyVaultUrl -DiskEncryptionKeyVaultId $keyVaultResourceId ; + + + + + + + + + + + + + + + + -------------------------- Enabling encryption using AAD Client ID, client cert thumbprint -------------------------- + + PS C:\> + + $rgName = 'MyResourceGroup'; +$vmName = 'MyWindowsVM'; -The default value is ReadWrite. Changing the caching value causes the virtual machine to restart. - This setting affects the consistency and performance of the disk. - - - ReadOnly - ReadWrite - - - - SourceImageUri - - - - This setting affects the consistency and performance of the disk. - - System.String - - - CreateOption - - Specifies whether this cmldet creates a disk in the virtual machine from a platform or user image, creates an empty disk, or attaches an existing disk. Valid values are: +#The KeyVault must have enabledForDiskEncryption property set on it +$vaultName= 'MyKeyVault'; +$keyVault = Get-AzureRmKeyVault -VaultName $vaultName -ResourceGroupName $rgname; +$diskEncryptionKeyVaultUrl = $keyVault.VaultUri; +$keyVaultResourceId = $keyVault.ResourceId; --- Attach --- Empty --- FromImage - This setting affects the consistency and performance of the disk. - - - empty - attach - fromImage - - - - Windows - - Indicates that the operating system on the user image is Windows. - - - - Profile - - Specifies the Azure profile from which this cmdlet reads. If you do not specify a profile, this cmdlet reads from the local default profile. - - AzureProfile - - - - Set-AzureRmVMOSDisk - - VM - - Specifies the local virtual machine object on which to set operating system disk properties. To obtain a virtual machine object, use the Get-AzureRmVM cmdlet. - - PSVirtualMachine - - - Name - - Specifies the name of the operating system disk. - - String - - - VhdUri - - Specifies the Uniform Resource Identifier (URI) of a virtual hard disk (VHD). - For an image based virtual machine, this parameter specifies the VHD file to create when a platform image or user image is specified. This is the location from which the image binary large object (BLOB) is copied to start the virtual machine. - For a disk based virtual machine boot scenario, this parameter specifies the VHD file that the virtual machine uses directly for starting up. - - String - - - Caching - - Specifies the caching mode of the operating system disk. Valid values are: +# create AAD application and associate the certificate +$certPath = 'C:\certificates\examplecert.pfx'; +$certPassword = 'yourPassword'; +$cert = New-Object System.Security.Cryptography.X509Certificates.X509Certificate2($certPath, $certPassword); +$keyValue = [System.Convert]::ToBase64String($cert.GetRawCertData()); +$azureAdApplication = New-AzureRmADApplication -DisplayName "<Your Application Display Name>" -HomePage "<https://YourApplicationHomePage>" -IdentifierUris "<https://YouApplicationUri>" -KeyValue $keyValue -KeyType AsymmetricX509Cert ; +$servicePrincipal = New-AzureRmADServicePrincipal –ApplicationId $azureAdApplication.ApplicationId; --- ReadOnly --- ReadWrite +$aadClientID = $azureAdApplication.ApplicationId; +$aadClientCertThumbprint= $cert.Thumbprint; -The default value is ReadWrite. Changing the caching value causes the virtual machine to restart. - This setting affects the consistency and performance of the disk. - - - ReadOnly - ReadWrite - - - - SourceImageUri - - - - This setting affects the consistency and performance of the disk. - - System.String - - - CreateOption - - Specifies whether this cmldet creates a disk in the virtual machine from a platform or user image, creates an empty disk, or attaches an existing disk. Valid values are: +#Upload pfx to KeyVault +$keyVaultSecretName = 'myaadcert'; +$fileContentBytes = get-content $certPath -Encoding Byte; +$fileContentEncoded = [System.Convert]::ToBase64String($fileContentBytes); +$jsonObject = @" { "data": "$filecontentencoded", "dataType" :"pfx", "password": "$certPassword" } "@ ; +$jsonObjectBytes = [System.Text.Encoding]::UTF8.GetBytes($jsonObject); +$jsonEncoded = [System.Convert]::ToBase64String($jsonObjectBytes); --- Attach --- Empty --- FromImage - This setting affects the consistency and performance of the disk. - - - empty - attach - fromImage - - - - Linux - - Indicates that the operating system on the user image is Linux. Specify this parameter for user image based virtual machine deployment. - - - - Profile - - Specifies the Azure profile from which this cmdlet reads. If you do not specify a profile, this cmdlet reads from the local default profile. - - AzureProfile - - - - - - Caching - - Specifies the caching mode of the operating system disk. Valid values are: +$secret = ConvertTo-SecureString -String $jsonEncoded -AsPlainText -Force; +Set-AzureKeyVaultSecret -VaultName $vaultName-Name $keyVaultSecretName -SecretValue $secret; +Set-AzureRmKeyVaultAccessPolicy -VaultName $vaultName -ResourceGroupName $rgName –EnabledForDeployment; + +#deploy cert to VM +$certUrl = (Get-AzureKeyVaultSecret -VaultName $vaultName -Name $keyVaultSecretName).Id +$sourceVaultId = (Get-AzureRmKeyVault -VaultName $vaultName -ResourceGroupName $rgName).ResourceId +$vm = Get-AzureRmVM -ResourceGroupName $rgName -Name $vmName +$vm = Add-AzureRmVMSecret -VM $vm -SourceVaultId $sourceVaultId -CertificateStore "My" -CertificateUrl $certUrl +Update-AzureRmVM -VM $vm -ResourceGroupName $rgName --- ReadOnly --- ReadWrite +#Enable encryption on the VM using AAD client ID and client cert thumbprint +Set-AzureRmVMDiskEncryptionExtension -ResourceGroupName $rgname -VMName $vmName -AadClientID $aadClientID -AadClientCertThumbprint $aadClientCertThumbprint -DiskEncryptionKeyVaultUrl $diskEncryptionKeyVaultUrl -DiskEncryptionKeyVaultId $keyVaultResourceId ; + + + + + + + + + + + + + + + + -------------------------- Enable encryption using AAD ClientID, Client Secret and wrap diskEncryptionKey with KeyEncryptionKey -------------------------- + + PS C:\> + + $rgName = 'MyResourceGroup'; +$vmName = 'MyWindowsVM'; -The default value is ReadWrite. Changing the caching value causes the virtual machine to restart. - This setting affects the consistency and performance of the disk. - - String - - String - - - none - - - CreateOption - - Specifies whether this cmldet creates a disk in the virtual machine from a platform or user image, creates an empty disk, or attaches an existing disk. Valid values are: +$aadClientID = "<clientID of your AAD app>"; +$aadClientSecret = "<clientSecret of your AAD app>"; --- Attach +$vaultName= 'MyKeyVault'; +$keyVault = Get-AzureRmKeyVault -VaultName $vaultName -ResourceGroupName $rgname; +$diskEncryptionKeyVaultUrl = $keyVault.VaultUri; +$keyVaultResourceId = $keyVault.ResourceId; + +$kek = Add-AzureKeyVaultKey -VaultName $vaultName -Name $kekName -Destination "Software" +$keyEncryptionKeyUrl = $kek.Key.kid; + +Set-AzureRmVMDiskEncryptionExtension -ResourceGroupName $rgname -VMName $vmName -AadClientID $aadClientID -AadClientSecret $aadClientSecret -DiskEncryptionKeyVaultUrl $diskEncryptionKeyVaultUrl -DiskEncryptionKeyVaultId $keyVaultResourceId -KeyEncryptionKeyUrl $keyEncryptionKeyUrl -KeyEncryptionKeyVaultId $keyVaultResourceId; + + + + + + + + + + + + + + + + -------------------------- Enable encryption using AAD Client ID , Client cert Thumbprint and wrap diskEncryptionKey with KeyEncryptionKey -------------------------- + + PS C:\> + + $rgName = 'MyResourceGroup'; +$vmName = 'MyWindowsVM'; + +#The KeyVault must have enabledForDiskEncryption property set on it +$vaultName= 'MyKeyVault'; +$keyVault = Get-AzureRmKeyVault -VaultName $vaultName -ResourceGroupName $rgname; +$diskEncryptionKeyVaultUrl = $keyVault.VaultUri; +$keyVaultResourceId = $keyVault.ResourceId; + +$kek = Add-AzureKeyVaultKey -VaultName $vaultName -Name $kekName -Destination "Software" +$keyEncryptionKeyUrl = $kek.Key.kid; + +# create AAD application and associate the certificate +$certPath = 'C:\certificates\examplecert.pfx'; +$certPassword = 'yourPassword'; +$cert = New-Object System.Security.Cryptography.X509Certificates.X509Certificate2($certPath, $certPassword); +$keyValue = [System.Convert]::ToBase64String($cert.GetRawCertData()); +$azureAdApplication = New-AzureRmADApplication -DisplayName "<Your Application Display Name>" -HomePage "<https://YourApplicationHomePage>" -IdentifierUris "<https://YouApplicationUri>" -KeyValue $keyValue -KeyType AsymmetricX509Cert ; +$servicePrincipal = New-AzureRmADServicePrincipal –ApplicationId $azureAdApplication.ApplicationId; + +$aadClientID = $azureAdApplication.ApplicationId; +$aadClientCertThumbprint= $cert.Thumbprint; + +#Upload pfx to KeyVault +$keyVaultSecretName = 'myaadcert'; +$fileContentBytes = get-content $certPath -Encoding Byte; +$fileContentEncoded = [System.Convert]::ToBase64String($fileContentBytes); +$jsonObject = @" { "data": "$filecontentencoded", "dataType" :"pfx", "password": "$certPassword" } "@ ; +$jsonObjectBytes = [System.Text.Encoding]::UTF8.GetBytes($jsonObject); +$jsonEncoded = [System.Convert]::ToBase64String($jsonObjectBytes); + +$secret = ConvertTo-SecureString -String $jsonEncoded -AsPlainText -Force; +Set-AzureKeyVaultSecret -VaultName $vaultName-Name $keyVaultSecretName -SecretValue $secret; +Set-AzureRmKeyVaultAccessPolicy -VaultName $vaultName -ResourceGroupName $rgName –EnabledForDeployment; + +#deploy cert to VM +$certUrl = (Get-AzureKeyVaultSecret -VaultName $vaultName -Name $keyVaultSecretName).Id +$sourceVaultId = (Get-AzureRmKeyVault -VaultName $vaultName -ResourceGroupName $rgName).ResourceId +$vm = Get-AzureRmVM -ResourceGroupName $rgName -Name $vmName +$vm = Add-AzureRmVMSecret -VM $vm -SourceVaultId $sourceVaultId -CertificateStore "My" -CertificateUrl $certUrl +Update-AzureRmVM -VM $vm -ResourceGroupName $rgName + +#Enable encryption on the VM using AAD client ID and client cert thumbprint +Set-AzureRmVMDiskEncryptionExtension -ResourceGroupName $rgname -VMName $vmName -AadClientID $aadClientID -AadClientCertThumbprint $aadClientCertThumbprint -DiskEncryptionKeyVaultUrl $diskEncryptionKeyVaultUrl -DiskEncryptionKeyVaultId $keyVaultResourceId ; + + + + + + + + + + + + + + + + + + + + + + Set-AzureRmVMDscExtension + + Configure the Windows PowerShell Desired State Configuration extension on a VM. + + + + + Set + AzureRmVMDscExtension + + + + Configure the Windows PowerShell Desired State Configuration extension on a VM in a resource group + + + + Set-AzureRmVMDscExtension + + ResourceGroupName + + The name of the resource group that contains the virtual machine + + String + + + VMName + + Name of the virtual machine where dsc extension handler would be installed + + String + + + Name + + Name of the ARM resource that represents the extension. This is defaulted to 'Microsoft.Powershell.DSC' + + String + + + ArchiveBlobName + + The name of the configuration file that was previously uploaded by Publish-AzureRmVMDSCConfiguration + + String + + + ArchiveStorageAccountName + + The Azure Storage Account name used to download the ArchiveBlobName + + String + + + ArchiveResourceGroupName + + The name of the resource group that contains the storage account containing the configuration archive. This param is optional if storage account and virtual machine both exists in the same resource group name,specified by ResourceGroupName param. + + String + + + ArchiveStorageEndpointSuffix + + The Storage Endpoint Suffix + + String + + + ArchiveContainerName + + Name of the Azure Storage Container where the configuration archive is located + + String + + + ConfigurationName + + Name of the configuration that will be invoked by the DSC Extension + + String + + + ConfigurationArgument + + A hashtable specifying the arguments to the ConfigurationFunction + + Hashtable + + + ConfigurationData + + Path to a .psd1 file that specifies the data for the Configuration + + String + + + Version + + The version of the DSC extension that Set-AzureRmVMDSCExtension will apply the settings to. Allowed format N.N + + String + + + Force + + By default Set-AzureRmVMDscExtension will not overwrite any existing blobs. Use -Force to overwrite them + + SwitchParameter + + + Location + + Location of the resource + + String + + + AutoUpdate + + We install the extension handler version specified by the -version param. By default extension handler is not autoupdated. Use -AutoUpdate to enable auto update of extension handler to the latest version as and when it is available. + + SwitchParameter + + + WmfVersion + + + Specifies the version of the Windows Management Framework (WMF) to install on the VM. The DSC Azure Extension depends on DSC features that are only available in the WMF updates. This parameter specifies which version of the update to install on the VM. The possible values are "4.0","latest" and "5.0PP". + A value of "4.0" will install KB3000850 (http://support.microsoft.com/kb/3000850) on Windows 8.1 or Windows Server 2012 R2, or WMF 4.0 (http://www.microsoft.com/en-us/download/details.aspx?id=40855) on other versions of Windows if a newer version isnt already installed. + A value of "5.0PP" will install the latest release of WMF 5.0PP (http://go.microsoft.com/fwlink/?LinkId=398175). A value of "latest" will install the latest WMF, currently WMF 5.0PP. The default value is "latest" + + String + + + InformationAction + + + + ActionPreference + + + InformationVariable + + + + String + + + WhatIf + + Describes what would happen if you executed the command without actually executing the command. + + SwitchParameter + + + Confirm + + Prompts you for confirmation before executing the command. + + SwitchParameter + + + + + + ResourceGroupName + + The name of the resource group that contains the virtual machine + + String + + String + + + + + + VMName + + Name of the virtual machine where dsc extension handler would be installed + + String + + String + + + + + + Name + + Name of the ARM resource that represents the extension. This is defaulted to 'Microsoft.Powershell.DSC' + + String + + String + + + + + + ArchiveBlobName + + The name of the configuration file that was previously uploaded by Publish-AzureRmVMDSCConfiguration + + String + + String + + + + + + ArchiveStorageAccountName + + The Azure Storage Account name used to download the ArchiveBlobName + + String + + String + + + + + + ArchiveResourceGroupName + + The name of the resource group that contains the storage account containing the configuration archive. This param is optional if storage account and virtual machine both exists in the same resource group name,specified by ResourceGroupName param. + + String + + String + + + + + + ArchiveStorageEndpointSuffix + + The Storage Endpoint Suffix + + String + + String + + + + + + ArchiveContainerName + + Name of the Azure Storage Container where the configuration archive is located + + String + + String + + + + + + ConfigurationName + + Name of the configuration that will be invoked by the DSC Extension + + String + + String + + + + + + ConfigurationArgument + + A hashtable specifying the arguments to the ConfigurationFunction + + Hashtable + + Hashtable + + + + + + ConfigurationData + + Path to a .psd1 file that specifies the data for the Configuration + + String + + String + + + + + + Version + + The version of the DSC extension that Set-AzureRmVMDSCExtension will apply the settings to. Allowed format N.N + + String + + String + + + + + + Force + + By default Set-AzureRmVMDscExtension will not overwrite any existing blobs. Use -Force to overwrite them + + SwitchParameter + + SwitchParameter + + + + + + Location + + Location of the resource + + String + + String + + + + + + AutoUpdate + + We install the extension handler version specified by the -version param. By default extension handler is not autoupdated. Use -AutoUpdate to enable auto update of extension handler to the latest version as and when it is available. + + SwitchParameter + + SwitchParameter + + + + + + WmfVersion + + + Specifies the version of the Windows Management Framework (WMF) to install on the VM. The DSC Azure Extension depends on DSC features that are only available in the WMF updates. This parameter specifies which version of the update to install on the VM. The possible values are "4.0","latest" and "5.0PP". + A value of "4.0" will install KB3000850 (http://support.microsoft.com/kb/3000850) on Windows 8.1 or Windows Server 2012 R2, or WMF 4.0 (http://www.microsoft.com/en-us/download/details.aspx?id=40855) on other versions of Windows if a newer version isnt already installed. + A value of "5.0PP" will install the latest release of WMF 5.0PP (http://go.microsoft.com/fwlink/?LinkId=398175). A value of "latest" will install the latest WMF, currently WMF 5.0PP. The default value is "latest" + + String + + String + + + latest + + + InformationAction + + + + ActionPreference + + ActionPreference + + + + + + InformationVariable + + + + String + + String + + + + + + WhatIf + + Describes what would happen if you executed the command without actually executing the command. + + SwitchParameter + + SwitchParameter + + + + + + Confirm + + Prompts you for confirmation before executing the command. + + SwitchParameter + + SwitchParameter + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Keywords: azure, azurerm, arm, resource, management, manager, compute, vm, iaas + + + + + -------------------------- EXAMPLE 1 -------------------------- + + PS C:\> + + Set-AzureRmVMDscExtension -ResourceGroupName Name -VMName VM -ArchiveBlobName Sample.ps1.zip -ArchiveStorageAccountName Stg -ConfigurationName ConfigName -Version 1.10 -Location 'West US' + + Description + + + + + + + + + + + + + + -------------------------- EXAMPLE 2 -------------------------- + + PS C:\> + + Set-AzureRmVMDscExtension -ResourceGroupName Name -VMName vm -ArchiveBlobName Sample.ps1.zip -ArchiveStorageAccountName Stg -ConfigurationName ConfigName -ConfigurationArgument @{arg="val"} -ArchiveContainerName WindowsPowerShellDSC -ConfigurationData SampleData.psd1 -Version 1.10 -Location 'West US' + + Description + + + + + + + + + + + + + + -------------------------- EXAMPLE 3 -------------------------- + + PS C:\> + + Set-AzureRmVMDscExtension -ResourceGroupName Name -VMName vm -ArchiveBlobName Sample.ps1.zip -ArchiveStorageAccountName Stg -ConfigurationName ConfigName -ConfigurationArgument @{arg="val"} -ArchiveContainerName WindowsPowerShellDSC -ConfigurationData SampleData.psd1 -Version 1.10 -Location 'West US' -AutoUpdate + + Description + + + + + + + + + + + + + + + + Unknown + + + + + + + + Set-AzureRmVMExtension + + Updates extension properties or adds an extension to a virtual machine. + + + + + Set + AzureRmVMExtension + + + + The Set-AzureRmVMExtension cmdlet updates properties for existing Virtual Machine Extensions or adds an extension to a virtual machine. + + + + Set-AzureRmVMExtension + + ResourceGroupName + + Specifies the name of a resource group. + + String + + + VMName + + Specifies the name of a virtual machine. This cmdlet modifies extensions for the virtual machine that this parameter specifies. + + String + + + Name + + Specifies the name of an extension. + + String + + + Publisher + + Specifies the name of the extension publisher. The publisher provides a name when the publisher registers an extension. + + String + + + ExtensionType + + Specifies the extension type. + + String + + + TypeHandlerVersion + + Specifies the version of the extension to use for this virtual machine. + + String + + + Settings + + Specifies public configuration for the extension, as a hash table. This cmdlet does not encrypt public configuration. + + Hashtable + + + ProtectedSettings + + Specifies private configuration for the extension, as a hash table. This cmdlet encrypts the private configuration. + + Hashtable + + + Location + + Specifies the location of the virtual machine. + + String + + + InformationAction + + + + ActionPreference + + + InformationVariable + + + + String + + + + Set-AzureRmVMExtension + + ResourceGroupName + + Specifies the name of a resource group. + + String + + + VMName + + Specifies the name of a virtual machine. This cmdlet modifies extensions for the virtual machine that this parameter specifies. + + String + + + Name + + Specifies the name of an extension. + + String + + + Publisher + + Specifies the name of the extension publisher. The publisher provides a name when the publisher registers an extension. + + String + + + ExtensionType + + Specifies the extension type. + + String + + + TypeHandlerVersion + + Specifies the version of the extension to use for this virtual machine. + + String + + + SettingString + + Specifies public configuration for the extension, as a string. This cmdlet does not encrypt public configuration. + + String + + + ProtectedSettingString + + Specifies private configuration for the extension, as a string. This cmdlet encrypts the private configuration. + + String + + + Location + + Specifies the location of the virtual machine. + + String + + + InformationAction + + + + ActionPreference + + + InformationVariable + + + + String + + + + + + ResourceGroupName + + Specifies the name of a resource group. + + String + + String + + + none + + + VMName + + Specifies the name of a virtual machine. This cmdlet modifies extensions for the virtual machine that this parameter specifies. + + String + + String + + + none + + + Name + + Specifies the name of an extension. + + String + + String + + + none + + + Publisher + + Specifies the name of the extension publisher. The publisher provides a name when the publisher registers an extension. + + String + + String + + + none + + + ExtensionType + + Specifies the extension type. + + String + + String + + + none + + + TypeHandlerVersion + + Specifies the version of the extension to use for this virtual machine. + + String + + String + + + none + + + Settings + + Specifies public configuration for the extension, as a hash table. This cmdlet does not encrypt public configuration. + + Hashtable + + Hashtable + + + none + + + ProtectedSettings + + Specifies private configuration for the extension, as a hash table. This cmdlet encrypts the private configuration. + + Hashtable + + Hashtable + + + none + + + Location + + Specifies the location of the virtual machine. + + String + + String + + + none + + + InformationAction + + + + ActionPreference + + ActionPreference + + + + + + InformationVariable + + + + String + + String + + + + + + SettingString + + Specifies public configuration for the extension, as a string. This cmdlet does not encrypt public configuration. + + String + + String + + + none + + + ProtectedSettingString + + Specifies private configuration for the extension, as a string. This cmdlet encrypts the private configuration. + + String + + String + + + none + + + Profile + + Specifies the Azure profile from which this cmdlet reads. If you do not specify a profile, this cmdlet reads from the local default profile. + + azureprofile + + azureprofile + + + none + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Keywords: azure, azurerm, arm, resource, management, manager, compute, vm, iaas + + + + + -------------------------- Example 1: Modify settings by using hash tables -------------------------- + + PS C:\> + + PS C:\>$Settings = @{"fileUris" = "[]"; "commandToExecute" = ""}; +PS C:\> $ProtectedSettings = @{"storageAccountName" = $stoname; "storageAccountKey" = $stokey}; +PS C:\> Set-AzureRmVMExtension -ResourceGroupName "ResourceGroup11" -Location "West US" -VMName "VirtualMachine22" -Name "ContosoTest" -Publisher "Contoso.Compute" -Type "CustomScriptExtension" -TypeHandlerVersion "1.1" -Settings $Settings -ProtectedSettings $ProtectedSettings; + + The first two commands use standard Windows PowerShell® syntax to create hash tables, and then stores those hash tables in the $Settings and $ProtectedSettings variables. For more information, type Get-Help about_Hash_Tables. The second command includes two values previously created and stored in variables. + + + + + + + + + + + + + + -------------------------- Example 2: Modify settings by using strings -------------------------- + + PS C:\> + + PS C:\>$SettingsString = '{"fileUris":[],"commandToExecute":""}'; +PS C:\> $ProtectedSettingsString = '{"storageAccountName":"' + $stoname + '","storageAccountKey":"' + $stokey + '"}'; +PS C:\> Set-AzureRmVMExtension -ResourceGroupName "ResourceGroup11" -Location "West US" -VMName "VirtualMachine22" -Name "CustomScriptExtension" -Publisher "Contoso.Compute" -Type "CustomScriptExtension" -TypeHandlerVersion "1.1" -SettingString $SettingsString -ProtectedSettingString $ProtectedSettingsString ; + + The first two commands create strings that contain settings, and then stores them in the $SettingsString and $ProtectedSettingsString variables. + + + + + + + + + + + + + + + + Get-AzureRmVMExtension + + + + Remove-AzureRmVMExtension + + + + + + + + Set-AzureRmVMOperatingSystem + + Sets operating system properties for a virtual machine. + + + + + Set + AzureRmVMOperatingSystem + + + + The Set-AzureRmVMOperatingSystem cmdlet sets operating system properties for a virtual machine. You can specify logon credentials computer name, and operating system type. + + + + Set-AzureRmVMOperatingSystem + + VM + + Specifies the local virtual machine object on which to set operating system properties. To obtain a virtual machine object, use the Get-AzureRmVM cmdlet. Create a virtual machine object by using the New-AzureRmVMConfig cmdlet. + + PSVirtualMachine + + + Windows + + Indicates that the type of operating system is Windows. + + SwitchParameter + + + ComputerName + + Specifies the name of the computer. + + String + + + Credential + + Specifies the user name and password for the virtual machine as a PSCredential object. To obtain a credential, use the Get-Credential cmdlet. For more information, type Get-Help Get-Credential. + + PSCredential + + + CustomData + + Specifies a base-64 encoded string of custom data. This is decoded to a binary array that is saved as a file on the virtual machine. The maximum length of the binary array is 65535 bytes. + + String + + + ProvisionVMAgent + + Indicates that the settings require that the virtual machine agent be installed on the virtual machine. + + SwitchParameter + + + EnableAutoUpdate + + Indicates that this cmdlet enables auto update. + + SwitchParameter + + + TimeZone + + Specifies the time zone for the virtual machine. + + String + + + WinRMHttp + + Indicates that this operating system uses HTTP WinRM. + + SwitchParameter + + + WinRMHttps + + Indicates that this operating system uses HTTPS WinRM. + + SwitchParameter + + + WinRMCertificateUrl + + Specifies the URI of a WinRM certificate. This needs to be stored in a Key Vault. + + Uri + + + InformationAction + + + + ActionPreference + + + InformationVariable + + + + String + + + + Set-AzureRmVMOperatingSystem + + VM + + Specifies the local virtual machine object on which to set operating system properties. To obtain a virtual machine object, use the Get-AzureRmVM cmdlet. Create a virtual machine object by using the New-AzureRmVMConfig cmdlet. + + PSVirtualMachine + + + Linux + + Indicates that the type of operating system is Linux. + + SwitchParameter + + + ComputerName + + Specifies the name of the computer. + + String + + + Credential + + Specifies the user name and password for the virtual machine as a PSCredential object. To obtain a credential, use the Get-Credential cmdlet. For more information, type Get-Help Get-Credential. + + PSCredential + + + CustomData + + Specifies a base-64 encoded string of custom data. This is decoded to a binary array that is saved as a file on the virtual machine. The maximum length of the binary array is 65535 bytes. + + String + + + DisablePasswordAuthentication + + Indicates that this cmdlet disables password authentication. + + SwitchParameter + + + InformationAction + + + + ActionPreference + + + InformationVariable + + + + String + + + + + + VM + + Specifies the local virtual machine object on which to set operating system properties. To obtain a virtual machine object, use the Get-AzureRmVM cmdlet. Create a virtual machine object by using the New-AzureRmVMConfig cmdlet. + + PSVirtualMachine + + PSVirtualMachine + + + none + + + Windows + + Indicates that the type of operating system is Windows. + + SwitchParameter + + SwitchParameter + + + none + + + ComputerName + + Specifies the name of the computer. + + String + + String + + + none + + + Credential + + Specifies the user name and password for the virtual machine as a PSCredential object. To obtain a credential, use the Get-Credential cmdlet. For more information, type Get-Help Get-Credential. + + PSCredential + + PSCredential + + + none + + + CustomData + + Specifies a base-64 encoded string of custom data. This is decoded to a binary array that is saved as a file on the virtual machine. The maximum length of the binary array is 65535 bytes. + + String + + String + + + none + + + ProvisionVMAgent + + Indicates that the settings require that the virtual machine agent be installed on the virtual machine. + + SwitchParameter + + SwitchParameter + + + none + + + EnableAutoUpdate + + Indicates that this cmdlet enables auto update. + + SwitchParameter + + SwitchParameter + + + none + + + TimeZone + + Specifies the time zone for the virtual machine. + + String + + String + + + none + + + WinRMHttp + + Indicates that this operating system uses HTTP WinRM. + + SwitchParameter + + SwitchParameter + + + none + + + WinRMHttps + + Indicates that this operating system uses HTTPS WinRM. + + SwitchParameter + + SwitchParameter + + + none + + + WinRMCertificateUrl + + Specifies the URI of a WinRM certificate. This needs to be stored in a Key Vault. + + Uri + + Uri + + + none + + + InformationAction + + + + ActionPreference + + ActionPreference + + + + + + InformationVariable + + + + String + + String + + + + + + Linux + + Indicates that the type of operating system is Linux. + + SwitchParameter + + SwitchParameter + + + none + + + DisablePasswordAuthentication + + Indicates that this cmdlet disables password authentication. + + SwitchParameter + + SwitchParameter + + + none + + + Profile + + Specifies the Azure profile from which this cmdlet reads. If you do not specify a profile, this cmdlet reads from the local default profile. + + azureprofile + + azureprofile + + + none + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Keywords: azure, azurerm, arm, resource, management, manager, compute, vm, iaas + + + + + -------------------------- Example 1: Set operating system properties for a new virtual machines -------------------------- + + PS C:\> + + PS C:\>$SecurePassword = ConvertTo-SecureString "password" -AsPlainText -Force +PS C:\> $Credential = New-Object System.Management.Automation.PSCredential ("FullerP", $SecurePassword); +PS C:\> $AvailabilitySet = Get-AzureRmAvailabilitySet -ResourceGroupName "ResourceGroup11" -Name "AvailabilitySet03" +PS C:\> $VirtualMachine = New-AzureRmVMConfig -VMName "VirtualMachine07" -VMSize "Standard_A1" -AvailabilitySetID $AvailabilitySet.Id +PS C:\> $ComputerName = "ContosoVM122" +PS C:\> $WinRMCertUrl = "http://keyVaultName.vault.azure.net/secrets/secretName/secretVersion" +PS C:\> $TimeZone = "Pacific Standard Time" +PS C:\> $CustomData = "echo 'Hello World'" +PS C:\> $VirtualMachine = Set-AzureRmVMOperatingSystem -VM $$VirtualMachine -Windows -ComputerName $ComputerName -Credential $Credential -CustomData $CustomData -WinRMHttp -WinRMHttps -WinRMCertificateUrl $WinRMCertUrl -ProvisionVMAgent -EnableAutoUpdate -TimeZone $TimeZone + + The first command converts a password to a secure string, and then stores it in the $SecurePassword variable. For more information, type Get-Help ConvertTo-SecureString. + + + The fourth command creates a virtual machine object, and then stores it in the $VirtualMachine variable. The command assigns a name and size to the virtual machine. The virtual machine belongs to the availability set stored in $AvailabilitySet. + + + + + + + + + + + + + Get-AzureRmVM + + + + New-AzureRmVMConfig + + + + + + + + Set-AzureRmVMOSDisk + + Sets the operating system disk properties on a virtual machine. + + + + + Set + AzureRmVMOSDisk + + + + The Set-AzureRmVMOSDisk cmdlet set the operating system disk properties on a virtual machine. + + + + Set-AzureRmVMOSDisk + + VM + + Specifies the local virtual machine object on which to set operating system disk properties. To obtain a virtual machine object, use the Get-AzureRmVM cmdlet. + + PSVirtualMachine + + + Name + + Specifies the name of the operating system disk. + + String + + + VhdUri + + Specifies the Uniform Resource Identifier (URI) of a virtual hard disk (VHD). + For an image based virtual machine, this parameter specifies the VHD file to create when a platform image or user image is specified. This is the location from which the image binary large object (BLOB) is copied to start the virtual machine. + For a disk based virtual machine boot scenario, this parameter specifies the VHD file that the virtual machine uses directly for starting up. + + String + + + Caching + + Specifies the caching mode of the operating system disk. Valid values are: + -- ReadOnly +-- ReadWrite + The default value is ReadWrite. Changing the caching value causes the virtual machine to restart. + This setting affects the consistency and performance of the disk. + + String + + + SourceImageUri + + This setting affects the consistency and performance of the disk. + + String + + + CreateOption + + Specifies whether this cmldet creates a disk in the virtual machine from a platform or user image, creates an empty disk, or attaches an existing disk. Valid values are: + -- Attach -- Empty -- FromImage - This setting affects the consistency and performance of the disk. - - System.String - - System.String - - - none - - - Linux - - Indicates that the operating system on the user image is Linux. Specify this parameter for user image based virtual machine deployment. - - SwitchParameter - - SwitchParameter - - - none - - - Name - - Specifies the name of the operating system disk. - - String - - String - - - none - - - Profile - - Specifies the Azure profile from which this cmdlet reads. If you do not specify a profile, this cmdlet reads from the local default profile. - - AzureProfile - - AzureProfile - - - none - - - SourceImageUri - - - - This setting affects the consistency and performance of the disk. - - System.String - - System.String - - - none - - - VhdUri - - Specifies the Uniform Resource Identifier (URI) of a virtual hard disk (VHD). - For an image based virtual machine, this parameter specifies the VHD file to create when a platform image or user image is specified. This is the location from which the image binary large object (BLOB) is copied to start the virtual machine. - For a disk based virtual machine boot scenario, this parameter specifies the VHD file that the virtual machine uses directly for starting up. - - String - - String - - - none - - - VM - - Specifies the local virtual machine object on which to set operating system disk properties. To obtain a virtual machine object, use the Get-AzureRmVM cmdlet. - - PSVirtualMachine - - PSVirtualMachine - - - none - - - Windows - - Indicates that the operating system on the user image is Windows. - - SwitchParameter - - SwitchParameter - - - none - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Example 1: Sets properties on a virtual machine - - - - - PS C:\>$AvailabilitySet = Get-AzureRmAvailabilitySet -ResourceGroupName "ResourceGroup11" -Name "AvailabilitySet03" -PS C:\> $VirtualMachine = New-AzureRmVMConfig -VMName "VirtualMachine07" -VMSize "Standard_A1" -AvailabilitySetID $AvailabilitySet.Id -PS C:\> Set-AzureRmVMOSDisk -VM $VirtualMachine -Name "OsDisk02" -VhdUri "os.vhd" -Caching ReadWrite - - - The first command gets the availability set named AvailablitySet03 in the resource group named ResourceGroup11, and then stores that object in the $AvailabilitySet variable. - The second command creates a virtual machine object, and then stores it in the $VirtualMachine variable. The command assigns a name and size to the virtual machine. The virtual machine belongs to the availability set stored in $AvailabilitySet. - The final command sets the properties on the virtual machine in $VirtualMachine. - - - - - - - - - - - - - Get-AzureRmVM - - - - Get-AzureRmAvailabilitySet - - - - New-AzureRmVMConfig - - - - - - Keywords: azure, azurerm, arm, resource, management, manager, compute, vm, iaas - - - - - - Set-AzureRmVMSourceImage - - Specifies the platform image for a virtual machine. - - - - - Set - AzureVMSourceImage - - - - The Set-AzureRmVMSourceImage cmdlet specifies the platform image to use for a virtual machine. - - - - Set-AzureRmVMSourceImage - - VM - - Specifies the local virtual machine object to configure. - - Microsoft.Azure.Commands.Compute.Models.PSVirtualMachine - - - Name - - Specifies the name of a source image. - - System.String - - - Profile - - Specifies the Azure profile from which this cmdlet reads. If you do not specify a profile, this cmdlet reads from the local default profile. - - Microsoft.Azure.Common.Authentication.Models.AzureProfile - - - - Set-AzureRmVMSourceImage - - VM - - Specifies the local virtual machine object to configure. - - Microsoft.Azure.Commands.Compute.Models.PSVirtualMachine - - - PublisherName - - Specifies the name of a publisher of a VMImage. To obtain a publisher, use the Get-AzureRmVMImagePublisher cmdlet. - - System.String - - - Offer - - Specifies the type of VMImage offer. To obtain an image offer, use the Get-AzureRmVMImageOffer cmdlet. - - System.String - - - Skus - - Specfies a VMImage SKU. To obtain SKUs, use the Get-AzureRmVMImageSku cmdlet. - - System.String - - - Version - - Specifies a version of a VMImage. To use the latest version, specify a value of latest instead of a particular version. - - System.String - - - Profile - - Specifies the Azure profile from which this cmdlet reads. If you do not specify a profile, this cmdlet reads from the local default profile. - - Microsoft.Azure.Common.Authentication.Models.AzureProfile - - - - - - Name - - Specifies the name of a source image. - - System.String - - System.String - - - none - - - Offer - - Specifies the type of VMImage offer. To obtain an image offer, use the Get-AzureRmVMImageOffer cmdlet. - - System.String - - System.String - - - none - - - Profile - - Specifies the Azure profile from which this cmdlet reads. If you do not specify a profile, this cmdlet reads from the local default profile. - - Microsoft.Azure.Common.Authentication.Models.AzureProfile - - Microsoft.Azure.Common.Authentication.Models.AzureProfile - - - none - - - PublisherName - - Specifies the name of a publisher of a VMImage. To obtain a publisher, use the Get-AzureRmVMImagePublisher cmdlet. - - System.String - - System.String - - - none - - - Skus - - Specfies a VMImage SKU. To obtain SKUs, use the Get-AzureRmVMImageSku cmdlet. - - System.String - - System.String - - - none - - - Version - - Specifies a version of a VMImage. To use the latest version, specify a value of latest instead of a particular version. - - System.String - - System.String - - - none - - - VM - - Specifies the local virtual machine object to configure. - - Microsoft.Azure.Commands.Compute.Models.PSVirtualMachine - - Microsoft.Azure.Commands.Compute.Models.PSVirtualMachine - - - none - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Example 1: Set values for an image - - - - - PS C:\>AvailabilitySet = Get-AzureRmAvailabilitySet -ResourceGroupName "ResourceGroup11" -Name "AvailabilitySet03" -PS C:\> $VirtualMachine = New-AzureRmVMConfig -VMName "VirtualMachine07" -VMSize "Standard_A1" -AvailabilitySetID $AvailabilitySet.Id -PS C:\> Set-AzureRmVMSourceImage -VM $VirtualMachine -PublisherName "MicrosoftWindowsServer" -Offer "WindowsServer" -Skus "2012-R2-Datacenter" -Version "latest" - - - - The first command gets the availability set named AvailablitySet03 in the resource group named ResourceGroup11, and then stores that object in the $AvailabilitySet variable. - The second command creates a virtual machine object, and then stores it in the $VirtualMachine variable. The command assigns a name and size to the virtual machine. The virtual machine belongs to the availability set stored in $AvailabilitySet. - The final command sets values for publisher name, offer, SKU, and version. The Get-AzureRmVMImagePublisher, Get-AzureRmVMImageOffer, Get-AzureRmVMImageSku, and Get-AzureRmVMImage cmdlets can discover these settings. - - - - - - - - - - - Example 2: Use the image reference method to set values - - - - - PS C:\>$Publisher = (Get-AzureRmVMImagePublisher -Location "Central US") | select -ExpandProperty PublisherName | where { $_ -like '*Microsoft*Windows*Server' } -PS C:\> $Offer = (Get-AzureRmVMImageOffer -Location "Central US" -PublisherName $Publisher[0]) | select -ExpandProperty Offer | where { $_ -like '*Windows*' } -PS C:\> $Sku = (Get-AzureRmVMImageSku -Location "Central US" -PublisherName $Publisher[0] -Offer $Offer[0]) | select -ExpandProperty Skus -PS C:\> $Versions = (Get-AzureRmVMImage -Location "Central US" -Offer -Offer $Offer[0] -PublisherName $Publisher[0] -Skus $Sku[0]) | select -ExpandProperty Version -PS C:\> $VMImage = Get-AzureRmVMImage -Location "Central US" -Offer -Offer $Offer[0] -PublisherName $Publisher[0] -Skus $Sku[0] -Version $Versions[0] -PS C:\> $VirtualMachine07 = Set-AzureRmVMSourceImage -VM $VirtualMachine07 -ImageReference $VMImage - - - This example sets source image settings by using the image reference method. - - - - - - - - - - - - - Get-AzureRmAvailabilitySet - - - - New-AzureRmVMConfig - - - - Get-AzureRmVMImagePublisher - - - - Get-AzureRmVMImageOffer - - - - Get-AzureRmVMImageSku - - - - Get-AzureRmVMImage - - - - - - Keywords: azure, azurerm, arm, resource, management, manager, compute, vm, iaas - - - - - - Set-AzureRmVM - - Marks a virtual machine as generalized. - - - - - Set - AzureVM - - - - The Set-AzureRmVM cmdlet marks a virtual machine as generalized. Before you run this cmdlet, log on to the virtual machine and use Sysprep to prepare the hard disk. - - - - Set-AzureRmVM - - ResourceGroupName - - Specifies the name of the resource group of the virtual machine. - - String - - - Name - - Specifies the name of the virtual machine on which this cmdlet operates. - - String - - - Generalized - - Indicates that this cmdlet marks a virtual machine as generalized. - - - - Profile - - Specifies the Azure profile from which this cmdlet reads. If you do not specify a profile, this cmdlet reads from the local default profile. - - AzureProfile - - - - - - Generalized - - Indicates that this cmdlet marks a virtual machine as generalized. - - SwitchParameter - - SwitchParameter - - - none - - - Name - - Specifies the name of the virtual machine on which this cmdlet operates. - - String - - String - - - none - - - Profile - - Specifies the Azure profile from which this cmdlet reads. If you do not specify a profile, this cmdlet reads from the local default profile. - - AzureProfile - - AzureProfile - - - none - - - ResourceGroupName - - Specifies the name of the resource group of the virtual machine. - - String - - String - - - none - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Example 1: Mark a virtual machine as generalized - - - - - PS C:\>Set-AzureRmVM -ResourceGroupName "ResourceGroup11" -Name "VirtualMachine07" -Generalized - - - This command marks the virtual machine named VirtualMachine07 as generalized. - - - - - - - - - - - - - Get-AzureRmVM - - - - - - Keywords: azure, azurerm, arm, resource, management, manager, compute, vm, iaas - - - - - - Start-AzureRmVM - - Starts an Azure virtual machine. - - - - - Start - AzureVM - - - - The Start-AzureRmVM cmdlet starts an Azure virtual machine. - - - - Start-AzureRmVM - - ResourceGroupName - - Specifies the name of a resource group. - - String - - - Name - - Specifies the name of the virtual machine to start. - - String - - - Profile - - Specifies the Azure profile from which this cmdlet reads. If you do not specify a profile, this cmdlet reads from the local default profile. - - AzureProfile - - - - - - Name - - Specifies the name of the virtual machine to start. - - String - - String - - - none - - - Profile - - Specifies the Azure profile from which this cmdlet reads. If you do not specify a profile, this cmdlet reads from the local default profile. - - AzureProfile - - AzureProfile - - - none - - - ResourceGroupName - - Specifies the name of a resource group. - - String - - String - - - none - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Example 1: Start a virtual machine - - - - - PS C:\>Start-AzureRmVM -ResourceGroupName "ResourceGroup11" -Name "VirtualMachine07" - - - This command starts the virtual machine named VirtualMachine07 in ResourceGroup11. - - - - - - - - - - - - - Get-AzureRmVM - - - - New-AzureRmVM - - - - Remove-AzureRmVM - - - - Restart-AzureRmVM - - - - Stop-AzureRmVM - - - - Update-AzureRmVM - - - - - - Keywords: azure, azurerm, arm, resource, management, manager, compute, vm, iaas - - - - - - Stop-AzureRmVM - - Stops an Azure virtual machine. - - - - - Stop - AzureVM - - - - The Stop-AzureRmVM cmdlet stops an Azure virtual machine. - - - - Stop-AzureRmVM - - ResourceGroupName - - Specifies the name of a resource group. - - String - - - Name - - Specifies the name of the virtual machine to stop. - - String - - - Force - - Forces the command to run without asking for user confirmation. - - - - Profile - - Specifies the Azure profile from which this cmdlet reads. If you do not specify a profile, this cmdlet reads from the local default profile. - - AzureProfile - - - StayProvisioned - - Indicates that this cmdlet uses the stay provisioned setting. - - - - - - - Force - - Forces the command to run without asking for user confirmation. - - SwitchParameter - - SwitchParameter - - - none - - - Name - - Specifies the name of the virtual machine to stop. - - String - - String - - - none - - - Profile - - Specifies the Azure profile from which this cmdlet reads. If you do not specify a profile, this cmdlet reads from the local default profile. - - AzureProfile - - AzureProfile - - - none - - - ResourceGroupName - - Specifies the name of a resource group. - - String - - String - - - none - - - StayProvisioned - - Indicates that this cmdlet uses the stay provisioned setting. - - SwitchParameter - - SwitchParameter - - - none - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Example 1: Stop a virtual machine - - - - - PS C:\>Stop-AzureRmVM -ResourceGroupName "ResourceGroup11" -Name "VirtualMachine07" - - - This command stops the virtual machine named VirtualMachine07 in ResourceGroup11. - - - - - - - - - - - - - Get-AzureRmVM - - - - New-AzureRmVM - - - - Remove-AzureRmVM - - - - Restart-AzureRmVM - - - - Start-AzureRmVM - - - - Update-AzureRmVM - - - - - - Keywords: azure, azurerm, arm, resource, management, manager, compute, vm, iaas - - - - - - Update-AzureRmVM - - Updates the state of an Azure virtual machine. - - - - - Update - AzureVM - - - - The Update-AzureRmVM cmdlet updates the state of an Azure virtual machine to the state of a virtual machine object. - - - - Update-AzureRmVM - - Name - - Specifies the name of the virtual machine to update. - - String - - - Profile - - Specifies the Azure profile from which this cmdlet reads. If you do not specify a profile, this cmdlet reads from the local default profile. - - AzureProfile - - - Tags - - - - - System.Collections.Hashtable[] - - - ResourceGroupName - - Specifies the name of a resource group. - - String - - - VM - - Specifies a local virtual machine object. To obtain a virtual machine object, use the Get-AzureRmVM cmdlet. This virtual machine object contains the updated state for the virtual machine. - - PSVirtualMachine - - - - - - Name - - Specifies the name of the virtual machine to update. - - String - - String - - - none - - - Profile - - Specifies the Azure profile from which this cmdlet reads. If you do not specify a profile, this cmdlet reads from the local default profile. - - AzureProfile - - AzureProfile - - - none - - - ResourceGroupName - - Specifies the name of a resource group. - - String - - String - - - none - - - Tags - - - - - System.Collections.Hashtable[] - - System.Collections.Hashtable[] - - - none - - - VM - - Specifies a local virtual machine object. To obtain a virtual machine object, use the Get-AzureRmVM cmdlet. This virtual machine object contains the updated state for the virtual machine. - - PSVirtualMachine - - PSVirtualMachine - - - none - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Example 1: Update a virtual machine - - - - - PS C:\>Update-AzureRmVM -ResourceGroupName "ResourceGroup11" -Name "VirtualMachine07" -VM $VirtualMachine - - - This command updates the virtual machine named VirtualMachine07 in ResourceGroup11. The command updates it by using another virtual machine object, stored in the $VirtualMachine variable. To obtain a virtual machine object, use the Get-AzureRmVM cmdlet. - - - - - - - - - - - - - Get-AzureRmVM - - - - New-AzureRmVM - - - - Remove-AzureRmVM - - - - Restart-AzureRmVM - - - - Start-AzureRmVM - - - - Stop-AzureRmVM - - - - New-AzureRmVMConfig - - - - - - Keywords: azure, azurerm, arm, resource, management, manager, compute, vm, iaas - - - - - - - - Remove-AzureRmVMDscExtension - - Removes DSC extension handler from a VM in a resource group - - - - - Remove - AzureVMDscExtension - - - - Removes DSC extension handler from a VM in a resource group - - - - Remove-AzureRmVMDscExtension - - ResourceGroupName - - The name of the resource group - - String - - - VMName - - The name of the virtual machine - - String - - - Name - - Name of the ARM resource that represents the extension. The Set-AzureRmVMDscExtension cmdlet sets this name to 'Microsoft.Powershell.DSC', which is the same value used by Remove-AzureRmVMDscExtension. Specify this parameter only if you changed the default name in the Set cmdlet or used a different resource name in an ARM template - - String - - - - - - ResourceGroupName - - The name of the resource group - - String - - String - - - - - - - VMName - - The name of the virtual machine - - String - - String - - - - - - - Name - - Name of the ARM resource that represents the extension. The Set-AzureRmVMDscExtension cmdlet sets this name to 'Microsoft.Powershell.DSC', which is the same value used by Remove-AzureRmVMDscExtension. Specify this parameter only if you changed the default name in the Set cmdlet or used a different resource name in an ARM template - - String - - String - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Keywords: azure, azurerm, arm, resource, management, manager, compute, vm, iaas - - - - - -------------------------- Example 1 -------------------------- - - PS C:\> - - PS C:\> Remove-AzureRmVMDscExtension –ResouceGroupName Name -VMName VM -Name DSC - - Description - ----------- - Removes the extension (Name - 'DSC') on virtual machine 'VM'. Specify Name parameter only when you changed its default value 'Microsoft.Powershell.DSC' to something else ('DSC' in this case) either through Set-AzureRmVMDscExtension cmdlet or an ARM template. - - - - - - - - - - - - - - - - - - - - - - - - - Get-AzureRmVMDscExtension - - - Gets the settings of the DSC extension on a particular VM - - - - - - Get - AzureVMDscExtension - - - - - Gets the settings of the DSC extension on a particular VM. - - - - - Get-AzureRmVMDscExtension - - ResourceGroupName - - The resource group name. - - string - - - VMName - - The virtual machine name - - string - - - Name - - Name of the ARM resource that represents the extension. The Set-AzureRmVMDscExtension cmdlet sets this name to 'Microsoft.Powershell.DSC', which is the same value used by Get-AzureRmVMDscExtension. Specify this parameter only if you changed the default name in the Set cmdlet or used a different resource name in an ARM template. - - String - - - Status - - Output shows status when the switch is present - - - - - - - - ResourceGroupName - - The resource group name. - - string - - string - - - - - - - VMName - - The virtual machine name - - string - - string - - - - - - - Name - - Name of the ARM resource that represents the extension. The Set-AzureRmVMDscExtension cmdlet sets this name to 'Microsoft.Powershell.DSC', which is the same value used by Get-AzureRmVMDscExtension. Specify this parameter only if you changed the default name in the Set cmdlet or used a different resource name in an ARM template. - - String - - String - - - - - - - Status - - Output shows status when the switch is present - - SwitchParameter - - SwitchParameter - - - - - - - - - - - - - - - - - - - - - - - - - - Microsoft.Azure.Commands.Compute.Extension.DSC.VirtualMachineDscExtensionContext - - - - - - - - - - - - - - - - - - - - - Keywords: azure, azurerm, arm, resource, management, manager, compute, vm, iaas - - - - - - - - - - - -------------------------- EXAMPLE 1 -------------------------- - - - C:\PS> - - -Get-AzureRmVMDscExtension -ResourceGroupName Name -VMName VM -Name 'DSC' - - Description - ----------- - Retrieves the settings of extension (Name - 'DSC') on virtual machine 'VM'. Specify Name parameter only when you changed its default value 'Microsoft.Powershell.DSC' to something else ('DSC' in this case) either through Set-AzureRmVMDscExtension cmdlet or an ARM template. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Set-AzureRmVMDSCExtension - - - Configure the Windows PowerShell Desired State Configuration extension on a VM. - - - - - - Set - AzureVMDscExtension - - - - - Configure the Windows PowerShell Desired State Configuration extension on a VM in a resource group - - - - - Set-AzureRmVMDSCExtension - - ArchiveBlobName - - The name of the configuration file that was previously uploaded by Publish-AzureRmVMDSCConfiguration - - string - - - ResourceGroupName - - The name of the resource group that contains the virtual machine - - string - - - VMName - - Name of the virtual machine where dsc extension handler would be installed - - string - - - ArchiveStorageAccountName - - The Azure Storage Account name used to download the ArchiveBlobName - - string - - - Version - - The version of the DSC extension that Set-AzureRmVMDSCExtension will apply the settings to. Allowed format N.N - - string - - - ConfigurationArgument - - A hashtable specifying the arguments to the ConfigurationFunction - - hashtable - - - ConfigurationData - - Path to a .psd1 file that specifies the data for the Configuration - - string - - - ConfigurationName - - Name of the configuration that will be invoked by the DSC Extension - - string - - - ArchiveResourceGroupName - - The name of the resource group that contains the storage account containing the configuration archive.This param is optional if storage account and virtual machine both exists in the same resource group name, specified by ResourceGroupName param - - string - - - ArchiveContainerName - - Name of the Azure Storage Container where the configuration archive is located - - string - - - Force - - By default Set-AzureRmVMDscExtension will not overwrite any existing blobs. Use -Force to overwrite them - - - - Location - - Location of the resource - - string - - - Name - - Name of the ARM resource that represents the extension. This is defaulted to 'Microsoft.Powershell.DSC' - - string - - - ArchiveStorageEndpointSuffix - - The Storage Endpoint Suffix - - string - - - AutoUpdate - - We install the extension handler version specified by the -version param. By default extension handler is not autoupdated. Use -AutoUpdate to enable auto update of extension handler to the latest version as and when it is available. - - - - Confirm - - Prompts you for confirmation before executing the command. - - - - WhatIf - - Describes what would happen if you executed the command without actually executing the command. - - - - WmfVersion - - - Specifies the version of the Windows Management Framework (WMF) to install on the VM. The DSC Azure Extension depends on DSC features that are only available in the WMF updates. This parameter specifies which version of the update to install on the VM. The possible values are "4.0","latest" and "5.0PP". - A value of "4.0" will install KB3000850 (http://support.microsoft.com/kb/3000850) on Windows 8.1 or Windows Server 2012 R2, or WMF 4.0 (http://www.microsoft.com/en-us/download/details.aspx?id=40855) on other versions of Windows if a newer version isnt already installed. - A value of "5.0PP" will install the latest release of WMF 5.0PP (http://go.microsoft.com/fwlink/?LinkId=398175). A value of "latest" will install the latest WMF, currently WMF 5.0PP. The default value is "latest" - - - string - - - - - - - ArchiveBlobName - - The name of the configuration file that was previously uploaded by Publish-AzureRmVMDSCConfiguration - - string - - string - - - - - - - ConfigurationArgument - - A hashtable specifying the arguments to the ConfigurationFunction - - hashtable - - hashtable - - - - - - - ConfigurationData - - Path to a .psd1 file that specifies the data for the Configuration - - string - - string - - - - - - - ConfigurationName - - Name of the configuration that will be invoked by the DSC Extension - - string - - string - - - - - - - ArchiveContainerName - - Name of the Azure Storage Container where the configuration archive is located - - string - - string - - - - - - - Force - - By default Set-AzureRmVMDscExtension will not overwrite any existing blobs. Use -Force to overwrite them - - SwitchParameter - - SwitchParameter - - - - - - - Location - - Location of the resource - - string - - string - - - - - - - Name - - Name of the ARM resource that represents the extension. This is defaulted to 'Microsoft.Powershell.DSC' - - string - - string - - - - - - - ResourceGroupName - - The name of the resource group that contains the virtual machine - - string - - string - - - - - - - ArchiveResourceGroupName - - The name of the resource group that contains the storage account containing the configuration archive. This param is optional if storage account and virtual machine both exists in the same resource group name,specified by ResourceGroupName param. - - string - - string - - - - - - - ArchiveStorageAccountName - - The Azure Storage Account name used to download the ArchiveBlobName - - string - - string - - - - - - - ArchiveStorageEndpointSuffix - - The Storage Endpoint Suffix - - string - - string - - - - - - - Version - - The version of the DSC extension that Set-AzureRmVMDSCExtension will apply the settings to. Allowed format N.N - - string - - string - - - - - - - VMName - - Name of the virtual machine where dsc extension handler would be installed - - string - - string - - - - - - - AutoUpdate - - We install the extension handler version specified by the -version param. By default extension handler is not autoupdated. Use -AutoUpdate to enable auto update of extension handler to the latest version as and when it is available. - - SwitchParameter - - SwitchParameter - - - - - - - Confirm - - Prompts you for confirmation before executing the command. - - SwitchParameter - - SwitchParameter - - - - - - WhatIf - - Describes what would happen if you executed the command without actually executing the command. - - SwitchParameter - - SwitchParameter - - - - - - WmfVersion - - - Specifies the version of the Windows Management Framework (WMF) to install on the VM. The DSC Azure Extension depends on DSC features that are only available in the WMF updates. This parameter specifies which version of the update to install on the VM. The possible values are "4.0","latest" and "5.0PP". - A value of "4.0" will install KB3000850 (http://support.microsoft.com/kb/3000850) on Windows 8.1 or Windows Server 2012 R2, or WMF 4.0 (http://www.microsoft.com/en-us/download/details.aspx?id=40855) on other versions of Windows if a newer version isnt already installed. - A value of "5.0PP" will install the latest release of WMF 5.0PP (http://go.microsoft.com/fwlink/?LinkId=398175). A value of "latest" will install the latest WMF, currently WMF 5.0PP. The default value is "latest" - - - string - - string - - - latest - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Keywords: azure, azurerm, arm, resource, management, manager, compute, vm, iaas - - - - - - - - - - - -------------------------- EXAMPLE 1 -------------------------- - - - C:\PS> - - - Set-AzureRmVMDscExtension -ResourceGroupName Name -VMName VM -ArchiveBlobName Sample.ps1.zip -ArchiveStorageAccountName Stg -ConfigurationName ConfigName -Version 1.10 -Location 'West US' - - - Description - ----------- - - Sets the extension on the 'VM' to download Sample.ps1.zip (from the 'Stg' storage account and the default container 'windows-powershell-dsc') that was previously uploaded using Publish-AzureRmVMDscConfiguration cmdlet and invokes configuration 'ConfigName'. - - - - - - - - - - - - - - - - - - - -------------------------- EXAMPLE 2 -------------------------- - - - C:\PS> - - - Set-AzureRmVMDscExtension -ResourceGroupName Name -VMName vm -ArchiveBlobName Sample.ps1.zip -ArchiveStorageAccountName Stg -ConfigurationName ConfigName -ConfigurationArgument @{arg="val"} -ArchiveContainerName WindowsPowerShellDSC -ConfigurationData SampleData.psd1 -Version 1.10 -Location 'West US' - - - Description - ----------- - Sets the extension on the VM to download Sample.ps1.zip (from the 'Stg' storage account and container 'WindowsPowerShellDSC' ) that was previously uploaded using Publish-AzureRmVMDscConfiguration cmdlet and invokes configuration 'ConfigName' with configuration data and arguments. - - - - - - - - - - - - - - - - - - - -------------------------- EXAMPLE 3 -------------------------- - - - C:\PS> - - - Set-AzureRmVMDscExtension -ResourceGroupName Name -VMName vm -ArchiveBlobName Sample.ps1.zip -ArchiveStorageAccountName Stg -ConfigurationName ConfigName -ConfigurationArgument @{arg="val"} -ArchiveContainerName WindowsPowerShellDSC -ConfigurationData SampleData.psd1 -Version 1.10 -Location 'West US' -AutoUpdate - - - Description - ----------- - Sets the extension on the VM to download Sample.ps1.zip (from the 'Stg' storage account and container 'WindowsPowerShellDSC' ) that was previously uploaded using Publish-AzureRmVMDscConfiguration cmdlet and invokes configuration 'ConfigName' with configuration data and arguments. Also, enables auto update of extension handler to the latest version as and when it is available. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Publish-AzureRmVMDscConfiguration - - - Uploads a Desired State Configuration script to Azure blob storage, which later can be applied to Azure Virtual Machines using the Set-AzureRmVMDscExtension cmdlet. - - - - - - Publish - AzureVMDscConfiguration - - - - - Uploads a Desired State Configuration script to Azure blob storage, which later can be applied to Azure Virtual Machines using the Set-AzureRmVMDscExtension cmdlet. - - - - - Publish-AzureRmVMDscConfiguration - - ConfigurationPath - - Path to a file containing one or more configurations. The file can be a PowerShell script (.ps1 file), module (.psm1 file). - - string - - - OutputArchivePath - - Path to a local ZIP file to write the configuration archive to. When this parameter is used, the configuration script is not uploaded to Azure blob storage. - - string - - - AdditionalPath - - Path to a file or a directory to include in the configuration archive. It gets downloaded to the VM along with the configuration - - string[] - - - ConfigurationDataPath - - Path to a .psd1 file that specifies the data for the Configuration. This is added to the configuration archive and then passed to the configuration function. It gets overwritten by the configuration data path provided through the Set-AzureRmVMDscExtension cmdlet - - string - - - Force - - By default Publish-AzureRmVMDscConfiguration will not overwrite any existing blobs or files. Use -Force to overwrite them. - - - - SkipDependencyDetection - - Excludes DSC resource dependencies from the configuration archive. - - - - Confirm - - Prompts you for confirmation before executing the command. - - - - WhatIf - - Describes what would happen if you executed the command without actually executing the command. - - - - - Publish-AzureRmVMDscConfiguration - - ConfigurationPath - - Path to a file containing one or more configurations. The file can be a PowerShell script (.ps1 file), module (.psm1 file). - - string - - - ResourceGroupName - - The name of the resource group that contains the storage account - - string - - - StorageAccountName - - The Azure Storage Account name used to upload the configuration script to the container specified by ContainerName - - string - - - ContainerName - - Name of the Azure Storage Container the configuration is uploaded to. - - string - - - AdditionalPath - - Path to a file or a directory to include in the configuration archive. It gets downloaded to the VM along with the configuration - - string[] - - - ConfigurationDataPath - - Path to a .psd1 file that specifies the data for the Configuration. This is added to the configuration archive and then passed to the configuration function. It gets overwritten by the configuration data path provided through the Set-AzureRmVMDscExtension cmdlet - - string - - - Force - - By default Publish-AzureRmVMDscConfiguration will not overwrite any existing blobs or files. Use -Force to overwrite them. - - - - SkipDependencyDetection - - Excludes DSC resource dependencies from the configuration archive. - - - - StorageEndpointSuffix - - Suffix for the storage end point, e.g. core.windows.net - - string - - - Confirm - - Prompts you for confirmation before executing the command. - - - - WhatIf - - Describes what would happen if you executed the command without actually executing the command. - - - - - - - - AdditionalPath - - Path to a file or a directory to include in the configuration archive. It gets downloaded to the VM along with the configuration - - string[] - - string[] - - - - - - - ConfigurationDataPath - - Path to a .psd1 file that specifies the data for the Configuration. This is added to the configuration archive and then passed to the configuration function. It gets overwritten by the configuration data path provided through the Set-AzureRmVMDscExtension cmdlet - - string - - string - - - - - - - ConfigurationPath - - Path to a file containing one or more configurations. The file can be a PowerShell script (.ps1 file), module (.psm1 file). - - string - - string - - - - - - - ContainerName - - Name of the Azure Storage Container the configuration is uploaded to. - - string - - string - - - - - - - Force - - By default Publish-AzureRmVMDscConfiguration will not overwrite any existing blobs or files. Use -Force to overwrite them. - - SwitchParameter - - SwitchParameter - - - - - - - OutputArchivePath - - Path to a local ZIP file to write the configuration archive to. When this parameter is used, the configuration script is not uploaded to Azure blob storage. - - string - - string - - - - - - - ResourceGroupName - - The name of the resource group that contains the storage account - - string - - string - - - - - - - SkipDependencyDetection - - Excludes DSC resource dependencies from the configuration archive. - - SwitchParameter - - SwitchParameter - - - - - - - StorageAccountName - - The Azure Storage Account name used to upload the configuration script to the container specified by ContainerName - - string - - string - - - - - - - StorageEndpointSuffix - - Suffix for the storage end point, e.g. core.windows.net - - string - - string - - - - - - - Confirm - - Prompts you for confirmation before executing the command. - - SwitchParameter - - SwitchParameter - - - - - - WhatIf - - Describes what would happen if you executed the command without actually executing the command. - - SwitchParameter - - SwitchParameter - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Keywords: azure, azurerm, arm, resource, management, manager, compute, vm, iaas - - - - - - - - - - - -------------------------- EXAMPLE 1 -------------------------- - - - C:\PS> - - -Publish-AzureRmVMDscConfiguration .\MyConfiguration.ps1 - - Description - ----------- - Creates a ZIP package for the given script and any dependent resource modules and uploads it to Azure Storage. - - - - - - - - - - - - - - - - - - - -------------------------- EXAMPLE 2 -------------------------- - - - C:\PS> - - -Publish-AzureRmVMDscConfiguration .\MyConfiguration.ps1 -OutputArchivePath .\MyConfiguration.ps1.zip - - Description - ----------- - Creates a ZIP package for the given script and any dependent resource modules and stores it in the local file .\MyConfiguration.ps1.zip. - - - - - - - - - - - - - - - - - - - -------------------------- EXAMPLE 3 -------------------------- - - - C:\PS> - - -Publish-AzureRmVMDscConfiguration -ConfigurationPath 'C:\Sample.ps1 -SkipDependencyDetection - - Description - ----------- - Adds configuration 'Sample.ps1' to the configuration archive to upload to Azure storage and skips dependent resource modules. - - - - - - - - - - - - - - - - - - - -------------------------- EXAMPLE 4 -------------------------- - - - C:\PS> - - -Publish-AzureRmVMDscConfiguration -ConfigurationPath C:\Sample.ps1 -ConfigurationDataPath 'C:\SampleData.psd1' - - Description - ----------- - Adds configuration 'Sample.ps1' and configuration data 'SampleData.psd1' to the configuration archive to upload to Azure storage. - - - - - - - - - - - - - - - - - - - -------------------------- EXAMPLE 5 -------------------------- - - - C:\PS> - - -Publish-AzureRmVMDscConfiguration -ConfigurationPath "C:\Sample.ps1" -AdditionalPath @("C:\ContentDir1", "C:\File.txt") -ConfigurationDataPath "C:\SampleData.psd1" - - Description - ----------- - Adds configuration 'Sample.ps1', configuration data 'SampleData.psd1' and additional content (files or directories referenced by the configuration) to configuration archive to upload to Azure storage. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Get-AzureRmVMDscExtensionStatus - - - Used to get the status of the DSC extension handler for a VM in a resource group. When a configuration is applied this cmdlet produces output consistent with Start-DscConfiguration. - - - - - - Get - AzureRmVMDscExtensionStatus - - - - - - - - - - - Get-AzureRmVMDscExtensionStatus - - ResourceGroupName - - The resource group name. - - string - - - VMName - - The virtual machine name - - string - - - Name - - Name of the ARM resource that represents the extension. The Set-AzureRmVMDscExtension cmdlet sets this name to 'Microsoft.Powershell.DSC', which is the same value used by Get-AzureRmVMDscExtensionStatus. Specify this parameter only if you changed the default name in the Set cmdlet or used a different resource name in an ARM template. - - string - - - - - - - Name - - Name of the ARM resource that represents the extension. The Set-AzureRmVMDscExtension cmdlet sets this name to 'Microsoft.Powershell.DSC', which is the same value used by Get-AzureRmVMDscExtensionStatus. Specify this parameter only if you changed the default name in the Set cmdlet or used a different resource name in an ARM template. - - string - - string - - - - - - - ResourceGroupName - - The resource group name. - - string - - string - - - - - - - VMName - - The virtual machine name - - string - - string - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Keywords: azure, azurerm, arm, resource, management, manager, compute, vm, iaas - - - - - - - - - - - - - - - - - - + This setting affects the consistency and performance of the disk. + + String + + + InformationAction + + + + ActionPreference + + + InformationVariable + + + + String + + + + Set-AzureRmVMOSDisk + + VM + + Specifies the local virtual machine object on which to set operating system disk properties. To obtain a virtual machine object, use the Get-AzureRmVM cmdlet. + + PSVirtualMachine + + + Name + + Specifies the name of the operating system disk. + + String + + + VhdUri + + Specifies the Uniform Resource Identifier (URI) of a virtual hard disk (VHD). + For an image based virtual machine, this parameter specifies the VHD file to create when a platform image or user image is specified. This is the location from which the image binary large object (BLOB) is copied to start the virtual machine. + For a disk based virtual machine boot scenario, this parameter specifies the VHD file that the virtual machine uses directly for starting up. + + String + + + Caching + + Specifies the caching mode of the operating system disk. Valid values are: + -- ReadOnly +-- ReadWrite + The default value is ReadWrite. Changing the caching value causes the virtual machine to restart. + This setting affects the consistency and performance of the disk. + + String + + + SourceImageUri + + This setting affects the consistency and performance of the disk. + + String + + + CreateOption + + Specifies whether this cmldet creates a disk in the virtual machine from a platform or user image, creates an empty disk, or attaches an existing disk. Valid values are: + -- Attach +-- Empty +-- FromImage + This setting affects the consistency and performance of the disk. + + String + + + Windows + + Indicates that the operating system on the user image is Windows. + + SwitchParameter + + + InformationAction + + + + ActionPreference + + + InformationVariable + + + + String + + + + Set-AzureRmVMOSDisk + + VM + + Specifies the local virtual machine object on which to set operating system disk properties. To obtain a virtual machine object, use the Get-AzureRmVM cmdlet. + + PSVirtualMachine + + + Name + + Specifies the name of the operating system disk. + + String + + + VhdUri + + Specifies the Uniform Resource Identifier (URI) of a virtual hard disk (VHD). + For an image based virtual machine, this parameter specifies the VHD file to create when a platform image or user image is specified. This is the location from which the image binary large object (BLOB) is copied to start the virtual machine. + For a disk based virtual machine boot scenario, this parameter specifies the VHD file that the virtual machine uses directly for starting up. + + String + + + Caching + + Specifies the caching mode of the operating system disk. Valid values are: + -- ReadOnly +-- ReadWrite + The default value is ReadWrite. Changing the caching value causes the virtual machine to restart. + This setting affects the consistency and performance of the disk. + + String + + + SourceImageUri + + This setting affects the consistency and performance of the disk. + + String + + + CreateOption + + Specifies whether this cmldet creates a disk in the virtual machine from a platform or user image, creates an empty disk, or attaches an existing disk. Valid values are: + -- Attach +-- Empty +-- FromImage + This setting affects the consistency and performance of the disk. + + String + + + Windows + + Indicates that the operating system on the user image is Windows. + + SwitchParameter + + + DiskEncryptionKeyUrl + + + + String + + + DiskEncryptionKeyVaultId + + + + String + + + KeyEncryptionKeyUrl + + + + String + + + KeyEncryptionKeyVaultId + + + + String + + + InformationAction + + + + ActionPreference + + + InformationVariable + + + + String + + + + Set-AzureRmVMOSDisk + + VM + + Specifies the local virtual machine object on which to set operating system disk properties. To obtain a virtual machine object, use the Get-AzureRmVM cmdlet. + + PSVirtualMachine + + + Name + + Specifies the name of the operating system disk. + + String + + + VhdUri + + Specifies the Uniform Resource Identifier (URI) of a virtual hard disk (VHD). + For an image based virtual machine, this parameter specifies the VHD file to create when a platform image or user image is specified. This is the location from which the image binary large object (BLOB) is copied to start the virtual machine. + For a disk based virtual machine boot scenario, this parameter specifies the VHD file that the virtual machine uses directly for starting up. + + String + + + Caching + + Specifies the caching mode of the operating system disk. Valid values are: + -- ReadOnly +-- ReadWrite + The default value is ReadWrite. Changing the caching value causes the virtual machine to restart. + This setting affects the consistency and performance of the disk. + + String + + + SourceImageUri + + This setting affects the consistency and performance of the disk. + + String + + + CreateOption + + Specifies whether this cmldet creates a disk in the virtual machine from a platform or user image, creates an empty disk, or attaches an existing disk. Valid values are: + -- Attach +-- Empty +-- FromImage + This setting affects the consistency and performance of the disk. + + String + + + Linux + + Indicates that the operating system on the user image is Linux. Specify this parameter for user image based virtual machine deployment. + + SwitchParameter + + + InformationAction + + + + ActionPreference + + + InformationVariable + + + + String + + + + Set-AzureRmVMOSDisk + + VM + + Specifies the local virtual machine object on which to set operating system disk properties. To obtain a virtual machine object, use the Get-AzureRmVM cmdlet. + + PSVirtualMachine + + + Name + + Specifies the name of the operating system disk. + + String + + + VhdUri + + Specifies the Uniform Resource Identifier (URI) of a virtual hard disk (VHD). + For an image based virtual machine, this parameter specifies the VHD file to create when a platform image or user image is specified. This is the location from which the image binary large object (BLOB) is copied to start the virtual machine. + For a disk based virtual machine boot scenario, this parameter specifies the VHD file that the virtual machine uses directly for starting up. + + String + + + Caching + + Specifies the caching mode of the operating system disk. Valid values are: + -- ReadOnly +-- ReadWrite + The default value is ReadWrite. Changing the caching value causes the virtual machine to restart. + This setting affects the consistency and performance of the disk. + + String + + + SourceImageUri + + This setting affects the consistency and performance of the disk. + + String + + + CreateOption + + Specifies whether this cmldet creates a disk in the virtual machine from a platform or user image, creates an empty disk, or attaches an existing disk. Valid values are: + -- Attach +-- Empty +-- FromImage + This setting affects the consistency and performance of the disk. + + String + + + Linux + + Indicates that the operating system on the user image is Linux. Specify this parameter for user image based virtual machine deployment. + + SwitchParameter + + + DiskEncryptionKeyUrl + + + + String + + + DiskEncryptionKeyVaultId + + + + String + + + KeyEncryptionKeyUrl + + + + String + + + KeyEncryptionKeyVaultId + + + + String + + + InformationAction + + + + ActionPreference + + + InformationVariable + + + + String + + + + + + VM + + Specifies the local virtual machine object on which to set operating system disk properties. To obtain a virtual machine object, use the Get-AzureRmVM cmdlet. + + PSVirtualMachine + + PSVirtualMachine + + + none + + + Name + + Specifies the name of the operating system disk. + + String + + String + + + none + + + VhdUri + + Specifies the Uniform Resource Identifier (URI) of a virtual hard disk (VHD). + For an image based virtual machine, this parameter specifies the VHD file to create when a platform image or user image is specified. This is the location from which the image binary large object (BLOB) is copied to start the virtual machine. + For a disk based virtual machine boot scenario, this parameter specifies the VHD file that the virtual machine uses directly for starting up. + + String + + String + + + none + + + Caching + + Specifies the caching mode of the operating system disk. Valid values are: + -- ReadOnly +-- ReadWrite + The default value is ReadWrite. Changing the caching value causes the virtual machine to restart. + This setting affects the consistency and performance of the disk. + + String + + String + + + none + + + SourceImageUri + + This setting affects the consistency and performance of the disk. + + String + + String + + + none + + + CreateOption + + Specifies whether this cmldet creates a disk in the virtual machine from a platform or user image, creates an empty disk, or attaches an existing disk. Valid values are: + -- Attach +-- Empty +-- FromImage + This setting affects the consistency and performance of the disk. + + String + + String + + + none + + + InformationAction + + + + ActionPreference + + ActionPreference + + + + + + InformationVariable + + + + String + + String + + + + + + Windows + + Indicates that the operating system on the user image is Windows. + + SwitchParameter + + SwitchParameter + + + none + + + DiskEncryptionKeyUrl + + + + String + + String + + + + + + DiskEncryptionKeyVaultId + + + + String + + String + + + + + + KeyEncryptionKeyUrl + + + + String + + String + + + + + + KeyEncryptionKeyVaultId + + + + String + + String + + + + + + Linux + + Indicates that the operating system on the user image is Linux. Specify this parameter for user image based virtual machine deployment. + + SwitchParameter + + SwitchParameter + + + none + + + Profile + + Specifies the Azure profile from which this cmdlet reads. If you do not specify a profile, this cmdlet reads from the local default profile. + + azureprofile + + azureprofile + + + none + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Keywords: azure, azurerm, arm, resource, management, manager, compute, vm, iaas + + + + + -------------------------- Example 1: Sets properties on a virtual machine -------------------------- + + PS C:\> + + PS C:\>$AvailabilitySet = Get-AzureRmAvailabilitySet -ResourceGroupName "ResourceGroup11" -Name "AvailabilitySet03" +PS C:\> $VirtualMachine = New-AzureRmVMConfig -VMName "VirtualMachine07" -VMSize "Standard_A1" -AvailabilitySetID $AvailabilitySet.Id +PS C:\> Set-AzureRmVMOSDisk -VM $VirtualMachine -Name "OsDisk02" -VhdUri "os.vhd" -Caching ReadWrite + + The first command gets the availability set named AvailablitySet03 in the resource group named ResourceGroup11, and then stores that object in the $AvailabilitySet variable. + + + + + + + + + + + + + + + + Get-AzureRmVM + + + + Get-AzureRmAvailabilitySet + + + + New-AzureRmVMConfig + + + + + + + + Set-AzureRmVMSourceImage + + Specifies the platform image for a virtual machine. + + + + + Set + AzureRmVMSourceImage + + + + The Set-AzureRmVMSourceImage cmdlet specifies the platform image to use for a virtual machine. + + + + Set-AzureRmVMSourceImage + + VM + + Specifies the local virtual machine object to configure. + + PSVirtualMachine + + + PublisherName + + Specifies the name of a publisher of a VMImage. To obtain a publisher, use the Get-AzureRmVMImagePublisher cmdlet. + + String + + + Offer + + Specifies the type of VMImage offer. To obtain an image offer, use the Get-AzureRmVMImageOffer cmdlet. + + String + + + Skus + + Specfies a VMImage SKU. To obtain SKUs, use the Get-AzureRmVMImageSku cmdlet. + + String + + + Version + + Specifies a version of a VMImage. To use the latest version, specify a value of latest instead of a particular version. + + String + + + InformationAction + + + + ActionPreference + + + InformationVariable + + + + String + + + + + + VM + + Specifies the local virtual machine object to configure. + + PSVirtualMachine + + PSVirtualMachine + + + none + + + PublisherName + + Specifies the name of a publisher of a VMImage. To obtain a publisher, use the Get-AzureRmVMImagePublisher cmdlet. + + String + + String + + + none + + + Offer + + Specifies the type of VMImage offer. To obtain an image offer, use the Get-AzureRmVMImageOffer cmdlet. + + String + + String + + + none + + + Skus + + Specfies a VMImage SKU. To obtain SKUs, use the Get-AzureRmVMImageSku cmdlet. + + String + + String + + + none + + + Version + + Specifies a version of a VMImage. To use the latest version, specify a value of latest instead of a particular version. + + String + + String + + + none + + + InformationAction + + + + ActionPreference + + ActionPreference + + + + + + InformationVariable + + + + String + + String + + + + + + Name + + Specifies the name of a source image. + + system.string + + system.string + + + none + + + Profile + + Specifies the Azure profile from which this cmdlet reads. If you do not specify a profile, this cmdlet reads from the local default profile. + + microsoft.azure.common.authentication.models.azureprofile + + microsoft.azure.common.authentication.models.azureprofile + + + none + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Keywords: azure, azurerm, arm, resource, management, manager, compute, vm, iaas + + + + + -------------------------- Example 1: Set values for an image -------------------------- + + PS C:\> + + PS C:\>AvailabilitySet = Get-AzureRmAvailabilitySet -ResourceGroupName "ResourceGroup11" -Name "AvailabilitySet03" +PS C:\> $VirtualMachine = New-AzureRmVMConfig -VMName "VirtualMachine07" -VMSize "Standard_A1" -AvailabilitySetID $AvailabilitySet.Id +PS C:\> Set-AzureRmVMSourceImage -VM $VirtualMachine -PublisherName "MicrosoftWindowsServer" -Offer "WindowsServer" -Skus "2012-R2-Datacenter" -Version "latest" + + The first command gets the availability set named AvailablitySet03 in the resource group named ResourceGroup11, and then stores that object in the $AvailabilitySet variable. + + + + + + + + + + + + + + -------------------------- Example 2: Use the image reference method to set values -------------------------- + + PS C:\> + + PS C:\>$Publisher = (Get-AzureRmVMImagePublisher -Location "Central US") | select -ExpandProperty PublisherName | where { $_ -like '*Microsoft*Windows*Server' } +PS C:\> $Offer = (Get-AzureRmVMImageOffer -Location "Central US" -PublisherName $Publisher[0]) | select -ExpandProperty Offer | where { $_ -like '*Windows*' } +PS C:\> $Sku = (Get-AzureRmVMImageSku -Location "Central US" -PublisherName $Publisher[0] -Offer $Offer[0]) | select -ExpandProperty Skus +PS C:\> $Versions = (Get-AzureRmVMImage -Location "Central US" -Offer -Offer $Offer[0] -PublisherName $Publisher[0] -Skus $Sku[0]) | select -ExpandProperty Version +PS C:\> $VMImage = Get-AzureRmVMImage -Location "Central US" -Offer -Offer $Offer[0] -PublisherName $Publisher[0] -Skus $Sku[0] -Version $Versions[0] +PS C:\> $VirtualMachine07 = Set-AzureRmVMSourceImage -VM $VirtualMachine07 -ImageReference $VMImage + + This example sets source image settings by using the image reference method. + + + + + + + + + + + + + + + + Get-AzureRmAvailabilitySet + + + + New-AzureRmVMConfig + + + + Get-AzureRmVMImagePublisher + + + + Get-AzureRmVMImageOffer + + + + Get-AzureRmVMImageSku + + + + Get-AzureRmVMImage + + + + + + + + Set-AzureRmVMSqlServerExtension + + + + + + + Set + AzureRmVMSqlServerExtension + + + + + + + + Set-AzureRmVMSqlServerExtension + + Version + + + + String + + + ResourceGroupName + + + + String + + + VMName + + + + String + + + Name + + + + String + + + AutoPatchingSettings + + + + AutoPatchingSettings + + + AutoBackupSettings + + + + AutoBackupSettings + + + Location + + + + String + + + InformationAction + + + + ActionPreference + + + InformationVariable + + + + String + + + + + + Version + + + + String + + String + + + + + + ResourceGroupName + + + + String + + String + + + + + + VMName + + + + String + + String + + + + + + Name + + + + String + + String + + + + + + AutoPatchingSettings + + + + AutoPatchingSettings + + AutoPatchingSettings + + + + + + AutoBackupSettings + + + + AutoBackupSettings + + AutoBackupSettings + + + + + + Location + + + + String + + String + + + + + + InformationAction + + + + ActionPreference + + ActionPreference + + + + + + InformationVariable + + + + String + + String + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Start-AzureRmVM + + Starts an Azure virtual machine. + + + + + Start + AzureRmVM + + + + The Start-AzureRmVM cmdlet starts an Azure virtual machine. + + + + Start-AzureRmVM + + Name + + Specifies the name of the virtual machine to start. + + String + + + ResourceGroupName + + Specifies the name of a resource group. + + String + + + InformationAction + + + + ActionPreference + + + InformationVariable + + + + String + + + + Start-AzureRmVM + + Name + + Specifies the name of the virtual machine to start. + + String + + + Id + + + + String + + + InformationAction + + + + ActionPreference + + + InformationVariable + + + + String + + + + + + Name + + Specifies the name of the virtual machine to start. + + String + + String + + + none + + + ResourceGroupName + + Specifies the name of a resource group. + + String + + String + + + none + + + InformationAction + + + + ActionPreference + + ActionPreference + + + + + + InformationVariable + + + + String + + String + + + + + + Id + + + + String + + String + + + + + + Profile + + Specifies the Azure profile from which this cmdlet reads. If you do not specify a profile, this cmdlet reads from the local default profile. + + azureprofile + + azureprofile + + + none + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Keywords: azure, azurerm, arm, resource, management, manager, compute, vm, iaas + + + + + -------------------------- Example 1: Start a virtual machine -------------------------- + + PS C:\> + + PS C:\>Start-AzureRmVM -ResourceGroupName "ResourceGroup11" -Name "VirtualMachine07" + + This command starts the virtual machine named VirtualMachine07 in ResourceGroup11. + + + + + + + + + + + + + + + + Get-AzureRmVM + + + + New-AzureRmVM + + + + Remove-AzureRmVM + + + + Restart-AzureRmVM + + + + Stop-AzureRmVM + + + + Update-AzureRmVM + + + + + + + + Stop-AzureRmVM + + Stops an Azure virtual machine. + + + + + Stop + AzureRmVM + + + + The Stop-AzureRmVM cmdlet stops an Azure virtual machine. + + + + Stop-AzureRmVM + + Name + + Specifies the name of the virtual machine to stop. + + String + + + Force + + Forces the command to run without asking for user confirmation. + + SwitchParameter + + + StayProvisioned + + Indicates that this cmdlet uses the stay provisioned setting. + + SwitchParameter + + + ResourceGroupName + + Specifies the name of a resource group. + + String + + + InformationAction + + + + ActionPreference + + + InformationVariable + + + + String + + + + Stop-AzureRmVM + + Name + + Specifies the name of the virtual machine to stop. + + String + + + Force + + Forces the command to run without asking for user confirmation. + + SwitchParameter + + + StayProvisioned + + Indicates that this cmdlet uses the stay provisioned setting. + + SwitchParameter + + + Id + + + + String + + + InformationAction + + + + ActionPreference + + + InformationVariable + + + + String + + + + + + Name + + Specifies the name of the virtual machine to stop. + + String + + String + + + none + + + Force + + Forces the command to run without asking for user confirmation. + + SwitchParameter + + SwitchParameter + + + none + + + StayProvisioned + + Indicates that this cmdlet uses the stay provisioned setting. + + SwitchParameter + + SwitchParameter + + + none + + + ResourceGroupName + + Specifies the name of a resource group. + + String + + String + + + none + + + InformationAction + + + + ActionPreference + + ActionPreference + + + + + + InformationVariable + + + + String + + String + + + + + + Id + + + + String + + String + + + + + + Profile + + Specifies the Azure profile from which this cmdlet reads. If you do not specify a profile, this cmdlet reads from the local default profile. + + azureprofile + + azureprofile + + + none + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Keywords: azure, azurerm, arm, resource, management, manager, compute, vm, iaas + + + + + -------------------------- Example 1: Stop a virtual machine -------------------------- + + PS C:\> + + PS C:\>Stop-AzureRmVM -ResourceGroupName "ResourceGroup11" -Name "VirtualMachine07" + + This command stops the virtual machine named VirtualMachine07 in ResourceGroup11. + + + + + + + + + + + + + + + + Get-AzureRmVM + + + + New-AzureRmVM + + + + Remove-AzureRmVM + + + + Restart-AzureRmVM + + + + Start-AzureRmVM + + + + Update-AzureRmVM + + + + + + + + Update-AzureRmVM + + Updates the state of an Azure virtual machine. + + + + + Update + AzureRmVM + + + + The Update-AzureRmVM cmdlet updates the state of an Azure virtual machine to the state of a virtual machine object. + + + + Update-AzureRmVM + + VM + + Specifies a local virtual machine object. To obtain a virtual machine object, use the Get-AzureRmVM cmdlet. This virtual machine object contains the updated state for the virtual machine. + + PSVirtualMachine + + + Tags + + + + Hashtable[] + + + ResourceGroupName + + Specifies the name of a resource group. + + String + + + InformationAction + + + + ActionPreference + + + InformationVariable + + + + String + + + + Update-AzureRmVM + + VM + + Specifies a local virtual machine object. To obtain a virtual machine object, use the Get-AzureRmVM cmdlet. This virtual machine object contains the updated state for the virtual machine. + + PSVirtualMachine + + + Tags + + + + Hashtable[] + + + Id + + + + String + + + InformationAction + + + + ActionPreference + + + InformationVariable + + + + String + + + + + + VM + + Specifies a local virtual machine object. To obtain a virtual machine object, use the Get-AzureRmVM cmdlet. This virtual machine object contains the updated state for the virtual machine. + + PSVirtualMachine + + PSVirtualMachine + + + none + + + Tags + + + + Hashtable[] + + Hashtable[] + + + none + + + ResourceGroupName + + Specifies the name of a resource group. + + String + + String + + + none + + + InformationAction + + + + ActionPreference + + ActionPreference + + + + + + InformationVariable + + + + String + + String + + + + + + Id + + + + String + + String + + + + + + Name + + Specifies the name of the virtual machine to update. + + string + + string + + + none + + + Profile + + Specifies the Azure profile from which this cmdlet reads. If you do not specify a profile, this cmdlet reads from the local default profile. + + azureprofile + + azureprofile + + + none + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Keywords: azure, azurerm, arm, resource, management, manager, compute, vm, iaas + + + + + -------------------------- Example 1: Update a virtual machine -------------------------- + + PS C:\> + + PS C:\>Update-AzureRmVM -ResourceGroupName "ResourceGroup11" -Name "VirtualMachine07" -VM $VirtualMachine + + This command updates the virtual machine named VirtualMachine07 in ResourceGroup11. The command updates it by using another virtual machine object, stored in the $VirtualMachine variable. To obtain a virtual machine object, use the Get-AzureRmVM cmdlet. + + + + + + + + + + + + + + + + Get-AzureRmVM + + + + New-AzureRmVM + + + + Remove-AzureRmVM + + + + Restart-AzureRmVM + + + + Start-AzureRmVM + + + + Stop-AzureRmVM + + + + New-AzureRmVMConfig + + + + + + + + Get-AzureRmVMExtensionImageDetail + + This cmdlet has been deprecated. + + + + + + + + + + This Get-AzureRmVMExtensionImageDetail cmdlet has been deprecated. + + + + + + FilterExpression + + + + string + + string + + + none + + + Location + + + + string + + string + + + none + + + Profile + + + + azureprofile + + azureprofile + + + none + + + PublisherName + + + + string + + string + + + none + + + Type + + + + string + + string + + + none + + + Version + + + + string + + string + + + none + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Keywords: azure, azurerm, arm, resource, management, manager, compute, vm, iaas + + + + + -------------------------- 1: -------------------------- + + PS C:\> + + PS C:\> + + + + + + + + + + + + + + + + + + + + + + Get-AzureRmVMImageDetail + + This cmdlet has been deprecated. + + + + + + + + + + The Get-AzureRmVMImageDetail cmdlet has been deprecated. + + + + + + Location + + + + string + + string + + + none + + + Offer + + + + string + + string + + + none + + + Profile + + + + azureprofile + + azureprofile + + + none + + + PublisherName + + + + string + + string + + + none + + + Skus + + + + string + + string + + + none + + + Version + + + + string + + string + + + none + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Keywords: azure, azurerm, arm, resource, management, manager, compute, vm, iaas + + + + + -------------------------- 1: -------------------------- + + PS C:\> + + PS C:\> + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/ResourceManager/Compute/Commands.Compute/Microsoft.Azure.Commands.Compute.format.ps1xml b/src/ResourceManager/Compute/Commands.Compute/Microsoft.Azure.Commands.Compute.format.ps1xml index fdb4c136e057..9f505cf386f0 100644 --- a/src/ResourceManager/Compute/Commands.Compute/Microsoft.Azure.Commands.Compute.format.ps1xml +++ b/src/ResourceManager/Compute/Commands.Compute/Microsoft.Azure.Commands.Compute.format.ps1xml @@ -608,6 +608,34 @@ - + + + Microsoft.Azure.Commands.Compute.Models.AzureDiskEncryptionStatusContext + + + Microsoft.Azure.Commands.Compute.Models.AzureDiskEncryptionStatusContext + + + + + + + + OsVolumeEncrypted + + + + OsVolumeEncryptionSettingsText + + + + DataVolumesEncrypted + + + + + + + \ No newline at end of file diff --git a/src/ResourceManager/Compute/Commands.Compute/Models/AzureDiskEncryptionStatusContext.cs b/src/ResourceManager/Compute/Commands.Compute/Models/AzureDiskEncryptionStatusContext.cs new file mode 100644 index 000000000000..5870bbb68744 --- /dev/null +++ b/src/ResourceManager/Compute/Commands.Compute/Models/AzureDiskEncryptionStatusContext.cs @@ -0,0 +1,18 @@ +using Microsoft.Azure.Management.Compute.Models; +using Newtonsoft.Json; + +namespace Microsoft.Azure.Commands.Compute.Models +{ + class AzureDiskEncryptionStatusContext + { + public bool OsVolumeEncrypted { get; set; } + public DiskEncryptionSettings OsVolumeEncryptionSettings { get; set; } + + [JsonIgnore] + public string OsVolumeEncryptionSettingsText + { + get { return JsonConvert.SerializeObject(OsVolumeEncryptionSettings, Formatting.Indented); } + } + public bool DataVolumesEncrypted { get; set;} + } +} diff --git a/src/ResourceManager/Compute/Commands.Compute/Properties/Resources.Designer.cs b/src/ResourceManager/Compute/Commands.Compute/Properties/Resources.Designer.cs index c2d3d503b79e..c53d41f9801f 100644 --- a/src/ResourceManager/Compute/Commands.Compute/Properties/Resources.Designer.cs +++ b/src/ResourceManager/Compute/Commands.Compute/Properties/Resources.Designer.cs @@ -296,6 +296,24 @@ public static string DscExtensionRemovalConfirmation { } } + /// + /// Looks up a localized string similar to Enable AzureDiskEncryption on the VM. + /// + public static string EnableAzureDiskEncryptionCaption { + get { + return ResourceManager.GetString("EnableAzureDiskEncryptionCaption", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to This cmdlet prepares the VM and enables encryption which may reboot the machine and takes 10-15 minutes to finish. Please save your work on the VM before confirming. Do you want to continue?. + /// + public static string EnableAzureDiskEncryptionConfirmation { + get { + return ResourceManager.GetString("EnableAzureDiskEncryptionConfirmation", resourceCulture); + } + } + /// /// Looks up a localized string similar to Error occurred when creating storage account for boot diagnostics. Keep creating a VM with disabling boot diagnostics. : {0}. /// diff --git a/src/ResourceManager/Compute/Commands.Compute/Properties/Resources.resx b/src/ResourceManager/Compute/Commands.Compute/Properties/Resources.resx index 76bc1d35abbc..893702f38826 100644 --- a/src/ResourceManager/Compute/Commands.Compute/Properties/Resources.resx +++ b/src/ResourceManager/Compute/Commands.Compute/Properties/Resources.resx @@ -452,6 +452,12 @@ The file needs to be a PowerShell script (.ps1 or .psm1) or a ZIP archive (.zip) Since the VM is created using premium storage, existing standard storage account, {0}, is used for boot diagnostics. {0} = existing standard storage account name + + Enable AzureDiskEncryption on the VM + + + This cmdlet prepares the VM and enables encryption which may reboot the machine and takes 10-15 minutes to finish. Please save your work on the VM before confirming. Do you want to continue? + Error occurred when getting storage account, {0}, for boot diagnostics: {1} {0} = storage account name, {1} = error message diff --git a/src/ResourceManager/Profile/Commands.Profile/Commands.Profile.csproj b/src/ResourceManager/Profile/Commands.Profile/Commands.Profile.csproj index eb7afedb961d..049b2df4626a 100644 --- a/src/ResourceManager/Profile/Commands.Profile/Commands.Profile.csproj +++ b/src/ResourceManager/Profile/Commands.Profile/Commands.Profile.csproj @@ -60,6 +60,10 @@ ..\..\..\packages\Microsoft.Azure.Common.2.1.0\lib\net45\Microsoft.Azure.Common.NetFramework.dll + + ..\..\..\packages\Microsoft.Azure.Management.Compute.9.1.0\lib\net40\Microsoft.Azure.Management.Compute.dll + True + False ..\..\..\packages\Microsoft.Azure.Management.Resources.2.18.7-preview\lib\net40\Microsoft.Azure.ResourceManager.dll diff --git a/src/ResourceManager/Profile/Commands.Profile/packages.config b/src/ResourceManager/Profile/Commands.Profile/packages.config index 1fe1ffe14084..1b9246399e8b 100644 --- a/src/ResourceManager/Profile/Commands.Profile/packages.config +++ b/src/ResourceManager/Profile/Commands.Profile/packages.config @@ -4,6 +4,7 @@ + diff --git a/src/ResourceManager/Resources/Commands.ResourceManager/Cmdlets/Commands.Resources.Rest.csproj b/src/ResourceManager/Resources/Commands.ResourceManager/Cmdlets/Commands.Resources.Rest.csproj index 1b8735d0561d..8d957f812551 100644 --- a/src/ResourceManager/Resources/Commands.ResourceManager/Cmdlets/Commands.Resources.Rest.csproj +++ b/src/ResourceManager/Resources/Commands.ResourceManager/Cmdlets/Commands.Resources.Rest.csproj @@ -58,6 +58,10 @@ False ..\..\..\..\packages\Microsoft.Azure.Common.Authentication.1.3.5-preview\lib\net45\Microsoft.Azure.Common.Authentication.dll + + ..\..\..\..\packages\Microsoft.Azure.Management.Compute.9.1.0\lib\net40\Microsoft.Azure.Management.Compute.dll + True + ..\..\..\..\packages\Microsoft.IdentityModel.Clients.ActiveDirectory.2.18.206251556\lib\net45\Microsoft.IdentityModel.Clients.ActiveDirectory.dll True diff --git a/src/ResourceManager/Resources/Commands.ResourceManager/Cmdlets/packages.config b/src/ResourceManager/Resources/Commands.ResourceManager/Cmdlets/packages.config index e2eaefa83ff8..99f1aa0be447 100644 --- a/src/ResourceManager/Resources/Commands.ResourceManager/Cmdlets/packages.config +++ b/src/ResourceManager/Resources/Commands.ResourceManager/Cmdlets/packages.config @@ -4,6 +4,7 @@ + diff --git a/src/ResourceManager/Storage/Commands.Management.Storage/Commands.Management.Storage.csproj b/src/ResourceManager/Storage/Commands.Management.Storage/Commands.Management.Storage.csproj index 7a0b1dcf7d29..f22d3c9a07cb 100644 --- a/src/ResourceManager/Storage/Commands.Management.Storage/Commands.Management.Storage.csproj +++ b/src/ResourceManager/Storage/Commands.Management.Storage/Commands.Management.Storage.csproj @@ -64,6 +64,10 @@ ..\..\..\packages\Microsoft.Azure.KeyVault.Core.1.0.0\lib\net40\Microsoft.Azure.KeyVault.Core.dll True + + ..\..\..\packages\Microsoft.Azure.Management.Compute.9.1.0\lib\net40\Microsoft.Azure.Management.Compute.dll + True + ..\..\..\packages\Microsoft.Azure.Management.Storage.2.4.0-preview\lib\net40\Microsoft.Azure.Management.Storage.dll diff --git a/src/ResourceManager/Storage/Commands.Management.Storage/packages.config b/src/ResourceManager/Storage/Commands.Management.Storage/packages.config index ad0ad96c0818..bdbfbde4be71 100644 --- a/src/ResourceManager/Storage/Commands.Management.Storage/packages.config +++ b/src/ResourceManager/Storage/Commands.Management.Storage/packages.config @@ -5,6 +5,7 @@ + diff --git a/src/ResourceManager/Tags/Commands.Tags/Commands.Tags.csproj b/src/ResourceManager/Tags/Commands.Tags/Commands.Tags.csproj index 08d7e6c040e5..fb4704b84b00 100644 --- a/src/ResourceManager/Tags/Commands.Tags/Commands.Tags.csproj +++ b/src/ResourceManager/Tags/Commands.Tags/Commands.Tags.csproj @@ -61,6 +61,10 @@ ..\..\..\packages\Microsoft.Azure.Common.2.1.0\lib\net45\Microsoft.Azure.Common.NetFramework.dll + + ..\..\..\packages\Microsoft.Azure.Management.Compute.9.1.0\lib\net40\Microsoft.Azure.Management.Compute.dll + True + False ..\..\..\packages\Microsoft.Azure.Management.Resources.2.18.7-preview\lib\net40\Microsoft.Azure.ResourceManager.dll diff --git a/src/ResourceManager/Tags/Commands.Tags/packages.config b/src/ResourceManager/Tags/Commands.Tags/packages.config index 1fe1ffe14084..1b9246399e8b 100644 --- a/src/ResourceManager/Tags/Commands.Tags/packages.config +++ b/src/ResourceManager/Tags/Commands.Tags/packages.config @@ -4,6 +4,7 @@ + diff --git a/src/ServiceManagement/Common/Commands.ServiceManagement.Common/Commands.ServiceManagement.Common.csproj b/src/ServiceManagement/Common/Commands.ServiceManagement.Common/Commands.ServiceManagement.Common.csproj index 804cd02c0912..10a77a774642 100644 --- a/src/ServiceManagement/Common/Commands.ServiceManagement.Common/Commands.ServiceManagement.Common.csproj +++ b/src/ServiceManagement/Common/Commands.ServiceManagement.Common/Commands.ServiceManagement.Common.csproj @@ -71,6 +71,10 @@ False ..\..\..\packages\Microsoft.Azure.Common.2.1.0\lib\net45\Microsoft.Azure.Common.NetFramework.dll + + ..\..\..\packages\Microsoft.Azure.Management.Compute.9.1.0\lib\net40\Microsoft.Azure.Management.Compute.dll + True + False ..\..\..\packages\Microsoft.Azure.Management.Resources.2.18.7-preview\lib\net40\Microsoft.Azure.ResourceManager.dll diff --git a/src/ServiceManagement/Common/Commands.ServiceManagement.Common/packages.config b/src/ServiceManagement/Common/Commands.ServiceManagement.Common/packages.config index 3f25db8f5500..6a43e49ff0b8 100644 --- a/src/ServiceManagement/Common/Commands.ServiceManagement.Common/packages.config +++ b/src/ServiceManagement/Common/Commands.ServiceManagement.Common/packages.config @@ -6,6 +6,7 @@ + diff --git a/src/ServiceManagement/Compute/Sync/Sync.csproj b/src/ServiceManagement/Compute/Sync/Sync.csproj index c5ba9c047121..ed894f45f991 100644 --- a/src/ServiceManagement/Compute/Sync/Sync.csproj +++ b/src/ServiceManagement/Compute/Sync/Sync.csproj @@ -51,6 +51,26 @@ false + + ..\..\..\packages\Hyak.Common.1.0.2\lib\net45\Hyak.Common.dll + True + + + ..\..\..\packages\Microsoft.Azure.Common.2.1.0\lib\net45\Microsoft.Azure.Common.dll + True + + + ..\..\..\packages\Microsoft.Azure.Common.2.1.0\lib\net45\Microsoft.Azure.Common.NetFramework.dll + True + + + ..\..\..\packages\Microsoft.Azure.KeyVault.Core.1.0.0\lib\net40\Microsoft.Azure.KeyVault.Core.dll + True + + + ..\..\..\packages\Microsoft.Azure.Management.Compute.9.1.0\lib\net40\Microsoft.Azure.Management.Compute.dll + True + False ..\..\..\packages\Microsoft.Data.Edm.5.6.4\lib\net40\Microsoft.Data.Edm.dll @@ -63,6 +83,18 @@ False ..\..\..\packages\Microsoft.Data.Services.Client.5.6.4\lib\net40\Microsoft.Data.Services.Client.dll + + ..\..\..\packages\Microsoft.Bcl.Async.1.0.168\lib\net40\Microsoft.Threading.Tasks.dll + True + + + ..\..\..\packages\Microsoft.Bcl.Async.1.0.168\lib\net40\Microsoft.Threading.Tasks.Extensions.dll + True + + + ..\..\..\packages\Microsoft.Bcl.Async.1.0.168\lib\net40\Microsoft.Threading.Tasks.Extensions.Desktop.dll + True + False ..\..\..\packages\Microsoft.WindowsAzure.ConfigurationManager.1.8.0.0\lib\net35-full\Microsoft.WindowsAzure.Configuration.dll @@ -78,6 +110,17 @@ + + + + ..\..\..\packages\Microsoft.Net.Http.2.2.22\lib\net45\System.Net.Http.Extensions.dll + True + + + ..\..\..\packages\Microsoft.Net.Http.2.2.22\lib\net45\System.Net.Http.Primitives.dll + True + + @@ -126,4 +169,9 @@ - + + + + + + \ No newline at end of file diff --git a/src/ServiceManagement/Compute/Sync/packages.config b/src/ServiceManagement/Compute/Sync/packages.config index fca0416f88cd..fe8ada5d0898 100644 --- a/src/ServiceManagement/Compute/Sync/packages.config +++ b/src/ServiceManagement/Compute/Sync/packages.config @@ -1,10 +1,19 @@  + + + + + + + + + - + \ No newline at end of file diff --git a/src/ServiceManagement/Compute/VhdManagement/VhdManagement.csproj b/src/ServiceManagement/Compute/VhdManagement/VhdManagement.csproj index f762ce3f01a7..c5cc80f7ebb8 100644 --- a/src/ServiceManagement/Compute/VhdManagement/VhdManagement.csproj +++ b/src/ServiceManagement/Compute/VhdManagement/VhdManagement.csproj @@ -50,9 +50,53 @@ true false - + + + ..\..\..\packages\Hyak.Common.1.0.2\lib\net45\Hyak.Common.dll + True + + + ..\..\..\packages\Microsoft.Azure.Common.2.1.0\lib\net45\Microsoft.Azure.Common.dll + True + + + ..\..\..\packages\Microsoft.Azure.Common.2.1.0\lib\net45\Microsoft.Azure.Common.NetFramework.dll + True + + + ..\..\..\packages\Microsoft.Azure.Management.Compute.9.1.0\lib\net40\Microsoft.Azure.Management.Compute.dll + True + + + ..\..\..\packages\Microsoft.Bcl.Async.1.0.168\lib\net40\Microsoft.Threading.Tasks.dll + True + + + ..\..\..\packages\Microsoft.Bcl.Async.1.0.168\lib\net40\Microsoft.Threading.Tasks.Extensions.dll + True + + + ..\..\..\packages\Microsoft.Bcl.Async.1.0.168\lib\net40\Microsoft.Threading.Tasks.Extensions.Desktop.dll + True + + + False + ..\..\..\packages\Newtonsoft.Json.6.0.4\lib\net45\Newtonsoft.Json.dll + True + - + + + + + ..\..\..\packages\Microsoft.Net.Http.2.2.22\lib\net45\System.Net.Http.Extensions.dll + True + + + ..\..\..\packages\Microsoft.Net.Http.2.2.22\lib\net45\System.Net.Http.Primitives.dll + True + + @@ -113,6 +157,12 @@ + + + + + + \ No newline at end of file diff --git a/src/ServiceManagement/Compute/VhdManagement/packages.config b/src/ServiceManagement/Compute/VhdManagement/packages.config new file mode 100644 index 000000000000..9113a511e018 --- /dev/null +++ b/src/ServiceManagement/Compute/VhdManagement/packages.config @@ -0,0 +1,12 @@ + + + + + + + + + + + + \ No newline at end of file