Panduan Migrasi untuk Az 2.0.0
Dokumen ini menjelaskan perubahan antara Az versi 1.0.0 dan 2.0.0
Daftar Isi
Perubahan modul yang dapat menyebabkan gangguan
Az.Compute
Menghapus Parameter
Managed
dari cmdletNew-AzAvailabilitySet
danUpdate-AzAvailabilitySet
yang mendukung penggunaanSku = Aligned
Sebelumnya
Update-AzAvailabilitySet -Managed
Sesudahnya
Update-AzAvailabilitySet -Sku Aligned
Untuk konsistensi, parameter
Image
dihapus dari set parameter 'ByName' dan 'ByResourceId' diUpdate-AzImage
Sebelumnya
Perhatikan bahwa kode berikut bersifat fungsional, tetapi ImageName yang diteruskan tidak digunakan sehingga menghapus parameter ini tidak berdampak pada fungsi.
Update-AzImage -ResourceGroupName $Rg -ImageName $Name -Image $Image -Tag $tags Update-AzImage -ResourceId $Id -Image $Image -Tag $tags
Sesudahnya
Update-AzImage -ResourceGroupName $Rg -ImageName $Name -Tag $tags Update-AzImage -ResourceId $Id -Tag $tags
Untuk konsistensi, parameter
Name
dihapus dari set parameter 'ByObject' dan 'ByResourceId' diRestart-AzVM
Sebelumnya
Perhatikan bahwa kode berikut bersifat fungsional, tetapi Nama yang diteruskan tidak digunakan sehingga menghapus parameter ini tidak berdampak pada fungsi.
Restart-AzVM -InputObject $VM -Name $Name Restart-AzVM -ResourceId $Id -Name $Name
Sesudahnya
Restart-AzVM -InputObject $VM Restart-AzVM -ResourceId $Id
Untuk konsistensi, parameter
Name
dihapus dari set parameter 'ByObject' dan 'ByResourceId' diStart-AzVM
Sebelumnya
Perhatikan bahwa kode berikut bersifat fungsional, tetapi Nama yang diteruskan tidak digunakan sehingga menghapus parameter ini tidak berdampak pada fungsi.
Start-AzVM -InputObject $VM -Name $Name Start-AzVM -ResourceId $Id -Name $Name
Sesudahnya
Start-AzVM -InputObject $VM Start-AzVM -ResourceId $Id
Untuk konsistensi, parameter
Name
dihapus dari set parameter 'ByObject' dan 'ByResourceId' diStop-AzVM
Sebelumnya
Perhatikan bahwa kode berikut bersifat fungsional, tetapi Nama yang diteruskan tidak digunakan sehingga menghapus parameter ini tidak berdampak pada fungsi.
Stop-AzVM -InputObject $VM -Name $Name Stop-AzVM -ResourceId $Id -Name $Name
Sesudahnya
Stop-AzVM -InputObject $VM Stop-AzVM -ResourceId $Id
Untuk konsistensi, parameter
Name
dihapus dari set parameter 'ByObject' dan 'ByResourceId' diRemove-AzVM
Sebelumnya
Perhatikan bahwa kode berikut bersifat fungsional, tetapi Nama yang diteruskan tidak digunakan sehingga menghapus parameter ini tidak berdampak pada fungsi.
Remove-AzVM -InputObject $VM -Name $Name Remove-AzVM -ResourceId $Id -Name $Name
Sesudahnya
Remove-AzVM -InputObject $VM Remove-AzVM -ResourceId $Id
Untuk konsistensi, parameter
Name
dihapus dari set parameter 'ByObject' dan 'ByResourceId' diSet-AzVM
Sebelumnya
Perhatikan bahwa kode berikut bersifat fungsional, tetapi Nama yang diteruskan tidak digunakan sehingga menghapus parameter ini tidak berdampak pada fungsi.
Set-AzVM -InputObject $VM -Name $Name ... Set-AzVM -ResourceId $Id -Name $Name ...
Sesudahnya
Set-AzVM -InputObject $VM ... Set-AzVM -ResourceId $Id ...
Untuk konsistensi, parameter
Name
dihapus dari set parameter 'ByObject' dan 'ByResourceId' diSave-AzVMImage
Sebelumnya
Perhatikan bahwa kode berikut bersifat fungsional, tetapi Nama yang diteruskan tidak digunakan sehingga menghapus parameter ini tidak berdampak pada fungsi.
Save-AzVMImage -InputObject $VM -Name $Name ... Save-AzVMImage -ResourceId $Id -Name $Name ...
Sesudahnya
Save-AzVMImage -InputObject $VM ... Save-AzVMImage -ResourceId $Id ...
Menambahkan properti ProtectionPolicy untuk merangkum properti
ProtectFromScaleIn
diPSVirtualMachineScaleSetVM
Sebelumnya
$vmss = Get-AzVMssVM ... $vmss.ProtectFromScaleIn = $true $vmss = Update-AzVMssVM ... $vmss.ProtectFromScaleIn = $true $vmss = Remove-AzVMssVMDataDisk ... $vmss.ProtectFromScaleIn = $true
Sesudahnya
$vmss = Get-AzVMssVM ... $vmss.ProtectionPolicy.ProtectFromScaleIn = $true $vmss = Update-AzVMssVM ... $vmss.ProtectionPolicy.ProtectFromScaleIn = $true $vmss = Remove-AzVMssVMDataDisk ... $vmss.ProtectionPolicy.ProtectFromScaleIn = $true
Menambahkan Properti
EncryptionSettingsCollection
untuk menyertakan propertiEncryptionSettings
diPSDisk
Sebelumnya
$disk = New-AzDisk ... | Set-AzDiskDiskEncrytionKey ... $disk.EncryptionSettings $disk = New-AzDisk ... | Set-AzDiskKeyEncrytionKey ... $disk.EncryptionSettings $update = New-AzDiskUpdateConfig | Set-AzDiskUpdateDiskEncryptionKey ... $update.EncryptionSettings $update = New-AzDiskUpdateConfig | Set-AzDiskUpdateKeyEncryptionKey ... $update.EncryptionSettings
Sesudahnya
$disk = New-AzDisk ... | Set-AzDiskDiskEncrytionKey ... $disk.EncryptionSettingsCollection.EncryptionSettings $disk = New-AzDisk ... | Set-AzDiskKeyEncrytionKey ... $disk.EncryptionSettingsCollection.EncryptionSettings $update = New-AzDiskUpdateConfig | Set-AzDiskUpdateDiskEncryptionKey ... $update.EncryptionSettingsCollection.EncryptionSettings $update = New-AzDiskUpdateConfig | Set-AzDiskUpdateKeyEncryptionKey ... $update.EncryptionSettingsCollection.EncryptionSettings
Menambahkan Properti
EncryptionSettingsCollection
untuk menyertakan propertiEncryptionSettings
diPSSnapshot
Sebelumnya
$snap = New-AzSnapshotConfig ... | Set-AzSnapshotDiskEncryptionKey ... $snap.EncryptionSettings $snap = New-AzSnapshotConfig ... | Set-AzSnapshotKeyEncryptionKey ... $snap.EncryptionSettings $update = New-AzSnapshotUpdateConfig ... | Set-AzSnapshotUpdateDiskEncryptionKey ... $update.EncryptionSettings $update = New-AzSnapshotUpdateConfig ... | Set-AzSnapshotUpdateKeyEncryptionKey ... $update.EncryptionSettings
Sesudahnya
$snap = New-AzSnapshotConfig ... | Set-AzSnapshotDiskEncryptionKey ... $snap.EncryptionSettingsCollection.EncryptionSettings $snap = New-AzSnapshotConfig ... | Set-AzSnapshotKeyEncryptionKey ... $snap.EncryptionSettingsCollection.EncryptionSettings $update = New-AzSnapshotUpdateConfig ... | Set-AzSnapshotUpdateDiskEncryptionKey ... $update.EncryptionSettingsCollection.EncryptionSettings $update = New-AzSnapshotUpdateConfig ... | Set-AzSnapshotUpdateKeyEncryptionKey ... $update.EncryptionSettingsCollection.EncryptionSettings
Menghapus properti
VirtualMachineProfile
dariPSVirtualMachineScaleSet
Sebelumnya
$vmss = New-AzVMSSConfig ... $vmss.VirtualMachineProfile.AdditionalCapabilities.UltraSSDEnabled = $true
Sesudahnya
$vmss = New-AzVMSSConfig ... $vmss.AdditionalCapabilities.UltraSSDEnabled = $true
Cmdlet
Set-AzVMBootDiagnostic
menghapus alias untukSet-AzVMBootDiagnostics
Sebelumnya
Menggunakan alias yang tidak digunakan lagi
Set-AzVMBootDiagnostics
Sesudahnya
Set-AzVMBootDIagnostic
Cmdlet
Export-AzLogAnalyticThrottledRequest
menghapus alias untukExport-AzLogAnalyticThrottledRequests
Sebelumnya
Menggunakan alias yang tidak digunakan lagi
Export-AzLogAnalyticThrottledRequests
Sesudahnya
Export-AzLogAnalyticThrottledRequest
Az.HDInsight
- Menghapus cmdlet
Grant-AzHDInsightHttpServicesAccess
danRevoke-AzHDInsightHttpServicesAccess
. Hal ini tidak lagi diperlukan karena akses HTTP selalu diaktifkan di semua kluster HDInsight. - Menambahkan cmdlet
Set-AzHDInsightGatewayCredential
baru. Gunakan cmdlet ini untuk mengubah nama pengguna dan kata sandi HTTP gateway (menggantikanGrant-AzHDInsightHttpServicesAccess
). - Memperbarui cmdlet
Get-AzHDInsightJobOutput
untuk mendukung akses berbasis peran granular ke kunci penyimpanan.- Pengguna dengan peran Operator Kluster HDInsight, Kontributor, atau Pemilik tidak akan terpengaruh.
- Pengguna dengan peran Pembaca saja perlu menentukan parameter
DefaultStorageAccountKey
secara eksplisit.
Untuk informasi selengkapnya tentang perubahan akses berbasis peran ini, lihat aka.ms/hdi-config-update
Sebelumnya
Grant-AzHDInsightHttpServicesAccess -ClusterName $cluster -HttpCredential $credential
Sesudahnya
Set-AzHDInsightGatewayCredential -ClusterName $cluster -HttpCredential $credential
Pengguna dengan peran Pembaca saja untuk cmdlet Get-AzHDInsightJobOutput
Sebelumnya
Get-AzHDInsightJobOutput -ClusterName $clusterName -JobId $jobId
Sesudahnya
Get-AzHDInsightJobOutput -ClusterName $clusterName -JobId $jobId -DefaultStorageAccountKey $storageAccountKey
Az.Storage
Namespace untuk jenis yang ditampilkan dari cmdlet Blob, Queue, dan File telah mengubah namespace-nya dari
Microsoft.WindowsAzure.Storage
menjadiMicrosoft.Azure.Storage
. Meskipun secara teknis bukan perubahan berisiko sesuai dengan kebijakan perubahan berisiko, hal ini memerlukan beberapa perubahan kode yang menggunakan metode dari Storage .Net SDK untuk berinteraksi dengan objek yang ditampilkan dari cmdlet ini.Contoh 1: Menambahkan pesan ke Queue (mengubah namespace objek CloudQueueMessage)
Sebelum:
$queue = Get-AzStorageQueue –Name $queueName –Context $ctx $queueMessage = New-Object -TypeName "Microsoft.WindowsAzure.Storage.Queue.CloudQueueMessage,$($queue.CloudQueue.GetType().Assembly.FullName)" -ArgumentList "This is message 1" $queue.CloudQueue.AddMessageAsync($QueueMessage)
Setelah:
$queue = Get-AzStorageQueue –Name $queueName –Context $ctx $queueMessage = New-Object -TypeName "Microsoft.Azure.Storage.Queue.CloudQueueMessage,$($queue.CloudQueue.GetType().Assembly.FullName)" -ArgumentList "This is message 1" $queue.CloudQueue.AddMessageAsync($QueueMessage)
Contoh 2: Mengambil Atribut Blob/File dengan AccessCondition (mengubah namespace objek AccessCondition)
Sebelum:
$accessCondition= New-Object Microsoft.WindowsAzure.Storage.AccessCondition $blob = Get-AzureStorageBlob -Container $containerName -Blob $blobName $blob.ICloudBlob.FetchAttributes($accessCondition) $file = Get-AzureStorageFile -ShareName $shareName -Path $filepath $file.FetchAttributes($accessCondition)
Setelah:
$accessCondition= New-Object Microsoft.Azure.Storage.AccessCondition $blob = Get-AzureStorageBlob -Container $containerName -Blob $blobName $blob.ICloudBlob.FetchAttributes($accessCondition) $file = Get-AzureStorageFile -ShareName $shareName -Path $filepath $file.FetchAttributes($accessCondition)
Meskipun tidak secara teknis merupakan perubahan yang melanggar, Anda akan melihat perbedaan output dalam properti Sku.Name Akun Penyimpanan yang dikembalikan dari
New/Get/Set-AzStorageAccount
perubahan adalah sebagai berikut. (Setelah perubahan, SkuName output dan input diselaraskan.)- "StandardLRS" -> "Standard_LRS";
- "StandardGRS" -> "Standard_GRS";
- "StandardRAGRS" -> "Standard_RAGRS";
- "StandardZRS" -> "Standard_ZRS";
- "PremiumLRS" -> "Premium_LRS";
Perilaku layanan default saat membuat akun penyimpanan tanpa menentukan Jenis telah berubah. Pada versi sebelumnya, saat akun penyimpanan dibuat tanpa menentukan
Kind
, Jenis Akun penyimpananStorage
digunakan, pada versi baruStorageV2
adalah nilai defaultKind
. Jika Anda perlu membuat Akun penyimpanan V1 dengan Jenis 'Storage', tambahkan parameter '-Kind Storage'Contoh: Membuat Akun penyimpanan (perubahan Jenis Default)
Sebelum:
PS c:\> New-AzStorageAccount -ResourceGroupName groupname -Name accountname -SkuName Standard_LRS -Location "westus" StorageAccountName ResourceGroupName Location SkuName Kind AccessTier CreationTime ProvisioningState EnableHttpsTrafficOnly ------------------ ----------------- -------- ------- ---- ---------- ------------ ----------------- ---------------------- accountname groupname westus StandardLRS Storage Hot 4/17/2018 10:34:32 AM Succeeded False
Setelah:
PS c:\> New-AzStorageAccount -ResourceGroupName groupname -Name accountname -SkuName Standard_LRS -Location "westus" StorageAccountName ResourceGroupName Location SkuName Kind AccessTier CreationTime ProvisioningState EnableHttpsTrafficOnly ------------------ ----------------- -------- ------- ---- ---------- ------------ ----------------- ---------------------- accountname groupname westus Standard_LRS StorageV2 Hot 4/17/2018 10:34:32 AM Succeeded False
Azure PowerShell
Saran dan Komentar
https://aka.ms/ContentUserFeedback.
Segera hadir: Sepanjang tahun 2024 kami akan menghentikan penggunaan GitHub Issues sebagai mekanisme umpan balik untuk konten dan menggantinya dengan sistem umpan balik baru. Untuk mengetahui informasi selengkapnya, lihat:Kirim dan lihat umpan balik untuk