|
| 1 | +--- |
| 2 | +external help file: Microsoft.Azure.Commands.Compute.dll-Help.xml |
| 3 | +online version: |
| 4 | +schema: 2.0.0 |
| 5 | +--- |
| 6 | + |
| 7 | +# Add-AzureRmImageDataDisk |
| 8 | + |
| 9 | +## SYNOPSIS |
| 10 | +Adds a data disk to an image obejct. |
| 11 | + |
| 12 | +## SYNTAX |
| 13 | + |
| 14 | +``` |
| 15 | +Add-AzureRmImageDataDisk [-Image] <Image> [[-Lun] <Int32>] [[-BlobUri] <String>] [[-Caching] <CachingTypes>] |
| 16 | + [[-DiskSizeGB] <Int32>] [[-SnapshotId] <String>] [[-ManagedDiskId] <String>] [<CommonParameters>] |
| 17 | +``` |
| 18 | + |
| 19 | +## DESCRIPTION |
| 20 | +The **Add-AzureRmImageDataDisk** cmdlet adds a data disk to an image object. |
| 21 | + |
| 22 | +## EXAMPLES |
| 23 | + |
| 24 | +### Example 1 |
| 25 | +``` |
| 26 | +PS C:\> $imageConfig = New-AzureRmImageConfig -Location 'West US'; |
| 27 | +PS C:\> $osDiskVhdUri = "https://contoso.blob.core.windows.net/test/os.vhd" |
| 28 | +PS C:\> $dataDiskVhdUri1 = "https://contoso.blob.core.windows.net/test/data1.vhd" |
| 29 | +PS C:\> $dataDiskVhdUri2 = "https://contoso.blob.core.windows.net/test/data2.vhd" |
| 30 | +PS C:\> Set-AzureRmImageOsDisk -Image $imageConfig -OsType 'Windows' -OsState 'Generalized' -BlobUri $osDiskVhdUri; |
| 31 | +PS C:\> Add-AzureRmImageDataDisk -Image $imageConfig -Lun 1 -BlobUri $dataDiskVhdUri1; |
| 32 | +PS C:\> Add-AzureRmImageDataDisk -Image $imageConfig -Lun 2 -BlobUri $dataDiskVhdUri2; |
| 33 | +PS C:\> New-AzureRmImage -Image $imageConfig -ImageName 'ImageName01' -ResourceGroupName 'ResourceGroup01'; |
| 34 | +``` |
| 35 | + |
| 36 | +The first command creates an image object, and then stores it in the $imageConfig variable. |
| 37 | + |
| 38 | +The next three commands assign paths of os disk and two data disks to the $osDiskVhdUri, $dataDiskVhdUri1, and $dataDiskVhdUri2 variables. |
| 39 | +This approach is only for readability of the following commands. |
| 40 | + |
| 41 | +The next three commands each adds an os disk and two data disks to the image stored in $imageConfig. |
| 42 | +The URI of each disk is stored in $osDiskVhdUri, $dataDiskVhdUri1, and $dataDiskVhdUri2. |
| 43 | + |
| 44 | +The final command creates an image named 'ImageName01' in resource group 'ResourceGroup01'. |
| 45 | + |
| 46 | +## PARAMETERS |
| 47 | + |
| 48 | +### -BlobUri |
| 49 | +Specifies the Uri of the blob. |
| 50 | + |
| 51 | +```yaml |
| 52 | +Type: String |
| 53 | +Parameter Sets: (All) |
| 54 | +Aliases: |
| 55 | + |
| 56 | +Required: False |
| 57 | +Position: 2 |
| 58 | +Default value: None |
| 59 | +Accept pipeline input: True (ByPropertyName) |
| 60 | +Accept wildcard characters: False |
| 61 | +``` |
| 62 | +
|
| 63 | +### -Caching |
| 64 | +Specifies the caching mode of the disk. |
| 65 | +
|
| 66 | +```yaml |
| 67 | +Type: CachingTypes |
| 68 | +Parameter Sets: (All) |
| 69 | +Aliases: |
| 70 | +Accepted values: None, ReadOnly, ReadWrite |
| 71 | + |
| 72 | +Required: False |
| 73 | +Position: 3 |
| 74 | +Default value: None |
| 75 | +Accept pipeline input: True (ByPropertyName) |
| 76 | +Accept wildcard characters: False |
| 77 | +``` |
| 78 | +
|
| 79 | +### -DiskSizeGB |
| 80 | +Specifies the size of the disk in GB. |
| 81 | +
|
| 82 | +```yaml |
| 83 | +Type: Int32 |
| 84 | +Parameter Sets: (All) |
| 85 | +Aliases: |
| 86 | + |
| 87 | +Required: False |
| 88 | +Position: 4 |
| 89 | +Default value: None |
| 90 | +Accept pipeline input: True (ByPropertyName) |
| 91 | +Accept wildcard characters: False |
| 92 | +``` |
| 93 | +
|
| 94 | +### -Image |
| 95 | +Specifies a local image object. |
| 96 | +
|
| 97 | +```yaml |
| 98 | +Type: Image |
| 99 | +Parameter Sets: (All) |
| 100 | +Aliases: |
| 101 | + |
| 102 | +Required: True |
| 103 | +Position: 0 |
| 104 | +Default value: None |
| 105 | +Accept pipeline input: True (ByPropertyName, ByValue) |
| 106 | +Accept wildcard characters: False |
| 107 | +``` |
| 108 | +
|
| 109 | +### -Lun |
| 110 | +Specifies the logical unit number (LUN). |
| 111 | +
|
| 112 | +```yaml |
| 113 | +Type: Int32 |
| 114 | +Parameter Sets: (All) |
| 115 | +Aliases: |
| 116 | + |
| 117 | +Required: False |
| 118 | +Position: 1 |
| 119 | +Default value: None |
| 120 | +Accept pipeline input: True (ByPropertyName) |
| 121 | +Accept wildcard characters: False |
| 122 | +``` |
| 123 | +
|
| 124 | +### -ManagedDiskId |
| 125 | +Specifies the ID of a managed disk. |
| 126 | +
|
| 127 | +```yaml |
| 128 | +Type: String |
| 129 | +Parameter Sets: (All) |
| 130 | +Aliases: |
| 131 | + |
| 132 | +Required: False |
| 133 | +Position: 6 |
| 134 | +Default value: None |
| 135 | +Accept pipeline input: True (ByPropertyName) |
| 136 | +Accept wildcard characters: False |
| 137 | +``` |
| 138 | +
|
| 139 | +### -SnapshotId |
| 140 | +Specifies the ID of a snapshot. |
| 141 | +
|
| 142 | +```yaml |
| 143 | +Type: String |
| 144 | +Parameter Sets: (All) |
| 145 | +Aliases: |
| 146 | + |
| 147 | +Required: False |
| 148 | +Position: 5 |
| 149 | +Default value: None |
| 150 | +Accept pipeline input: True (ByPropertyName) |
| 151 | +Accept wildcard characters: False |
| 152 | +``` |
| 153 | +
|
| 154 | +### CommonParameters |
| 155 | +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters (http://go.microsoft.com/fwlink/?LinkID=113216). |
| 156 | +
|
| 157 | +## INPUTS |
| 158 | +
|
| 159 | +### Microsoft.Azure.Management.Compute.Models.Image |
| 160 | +System.Int32 |
| 161 | +System.String |
| 162 | +System.Nullable`1[[Microsoft.Azure.Management.Compute.Models.CachingTypes, Microsoft.Azure.Management.Compute, Version=14.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35]] |
| 163 | +System.Nullable`1[[System.Int32, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]] |
| 164 | + |
| 165 | +## OUTPUTS |
| 166 | + |
| 167 | +### Microsoft.Azure.Management.Compute.Models.Image |
| 168 | + |
| 169 | +## NOTES |
| 170 | + |
| 171 | +## RELATED LINKS |
| 172 | + |
0 commit comments