Set-AzStorageBlobInventoryPolicy
Membuat atau memperbarui kebijakan inventori blob di akun Storage.
Sintaks
Set-AzStorageBlobInventoryPolicy
[-ResourceGroupName] <String>
[-StorageAccountName] <String>
-Rule <PSBlobInventoryPolicyRule[]>
[-Disabled]
[-DefaultProfile <IAzureContextContainer>]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
Set-AzStorageBlobInventoryPolicy
[-ResourceGroupName] <String>
[-StorageAccountName] <String>
-Policy <PSBlobInventoryPolicy>
[-DefaultProfile <IAzureContextContainer>]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
Set-AzStorageBlobInventoryPolicy
-StorageAccount <PSStorageAccount>
-Rule <PSBlobInventoryPolicyRule[]>
[-Disabled]
[-DefaultProfile <IAzureContextContainer>]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
Set-AzStorageBlobInventoryPolicy
-StorageAccount <PSStorageAccount>
-Policy <PSBlobInventoryPolicy>
[-DefaultProfile <IAzureContextContainer>]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
Set-AzStorageBlobInventoryPolicy
[-StorageAccountResourceId] <String>
-Rule <PSBlobInventoryPolicyRule[]>
[-Disabled]
[-DefaultProfile <IAzureContextContainer>]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
Set-AzStorageBlobInventoryPolicy
[-StorageAccountResourceId] <String>
-Policy <PSBlobInventoryPolicy>
[-DefaultProfile <IAzureContextContainer>]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
Deskripsi
Cmdlet Set-AzStorageBlobInventoryPolicy membuat atau memperbarui kebijakan inventori blob di akun Penyimpanan.
Contoh
Contoh 1: Membuat atau memperbarui kebijakan inventaris blob dengan objek aturan BlobInventoryPolicy.
$rule1 = New-AzStorageBlobInventoryPolicyRule -Name Test1 -Destination $containerName -Disabled -Format Csv -Schedule Daily -ContainerSchemaField Name,Metadata,PublicAccess,Last-mOdified,LeaseStatus,LeaseState,LeaseDuration,HasImmutabilityPolicy,HasLegalHold -PrefixMatch con1,con2
$rule2 = New-AzStorageBlobInventoryPolicyRule -Name Test2 -Destination $containerName -Format Parquet -Schedule Weekly -IncludeBlobVersion -IncludeSnapshot -BlobType blockBlob,appendBlob -PrefixMatch aaa,bbb `
-BlobSchemaField name,Creation-Time,Last-Modified,Content-Length,Content-MD5,BlobType,AccessTier,AccessTierChangeTime,Expiry-Time,hdi_isfolder,Owner,Group,Permissions,Acl,Metadata
$rule3 = New-AzStorageBlobInventoryPolicyRule -Name Test3 -Destination $containerName -Format Parquet -Schedule Weekly -IncludeBlobVersion -IncludeSnapshot -IncludeDeleted -BlobType blockBlob,appendBlob -PrefixMatch aaa,bbb `
-ExcludePrefix ccc,ddd -BlobSchemaField name,Last-Modified,BlobType,AccessTier,AccessTierChangeTime,Content-Type,Content-CRC64,CopyId,x-ms-blob-sequence-number,TagCount
$policy = Set-AzStorageBlobInventoryPolicy -ResourceGroupName "myresourcegroup" -AccountName "mystorageaccount" -Disabled -Rule $rule1,$rule2,$rule3
$policy
StorageAccountName : mystorageaccount
ResourceGroupName : myresourcegroup
Name : DefaultInventoryPolicy
Id : /subscriptions/{subscription-Id}/resourceGroups/myresourcegroup/providers/Microsoft.Storage/storageAccounts/mystorageaccount/inventoryPolicies/default
Type : Microsoft.Storage/storageAccounts/inventoryPolicies
LastModifiedTime : 5/12/2021 8:53:38 AM
Enabled : False
Rules : {Test1, Test2, Test3}
$policy.Rules
Name Enabled Destination ObjectType Format Schedule IncludeSnapshots IncludeBlobVersions IncludeDeleted BlobTypes PrefixMatch ExcludePrefix SchemaFields
---- ------- ----------- ---------- ------ -------- ---------------- ------------------- -------------- --------- ----------- ------------- ------------
Test1 False containername Container Csv Daily {con1, con2} {Name, Metadata, PublicAccess, Last-Modified...}
Test2 True containername Blob Parquet Weekly True True {blockBlob, appendBlob} {aaa, bbb} {Name, Creation-Time, Last-Modified, Content-Length...}
Test3 True containername Blob Parquet Weekly True True True {blockBlob, appendBlob} {aaa, bbb} {ccc, ddd} {Name, Content-Type, Content-CRC64, Last-Modified...}
2 perintah pertama ini membuat 3 objek aturan BlobInventoryPolicy: aturan "Test1" untuk inventaris contaienr; aturan "Test2" dan "Test3" untuk inventaris blob. Perintah berikut menetapkan kebijakan inventaris blob ke akun Storage dengan 2 objek aturan, lalu menampilkan properti kebijakan dan aturan yang diperbarui.
Contoh 2: Membuat atau memperbarui kebijakan inventori blob akun Storage dengan kebijakan format Json.
$policy = Set-AzStorageBlobInventoryPolicy -ResourceGroupName $resourceGroupName -StorageAccountName $accountName -Policy (@{
Enabled=$true;
Rules=(@{
Enabled=$true;
Name="Test1";
Destination=$containerName;
Definition=(@{
ObjectType="Blob";
Format="Csv";
Schedule="Weekly";
SchemaFields=@("name","Content-Length","BlobType","Snapshot","VersionId","IsCurrentVersion");
Filters=(@{
BlobTypes=@("blockBlob","appendBlob");
PrefixMatch=@("prefix1","prefix2");
IncludeSnapshots=$true;
IncludeBlobVersions=$true;
})
})
},
@{
Enabled=$false;
Name="Test2";
Destination=$containerName;
Definition=(@{
ObjectType="Container";
Format="Parquet";
Schedule="Daily";
SchemaFields=@("name","Metadata","PublicAccess","DefaultEncryptionScope","DenyEncryptionScopeOverride");
Filters=(@{
PrefixMatch=@("conpre1","conpre2");
})
})
},
@{
Enabled=$false;
Name="Test3";
Destination=$containerName;
Definition=(@{
ObjectType="Blob";
Format="Csv";
Schedule="Weekly";
SchemaFields=@("name","Deleted","RemainingRetentionDays","Content-Type","Content-Language","Cache-Control","Content-Disposition");
Filters=(@{
BlobTypes=@("blockBlob","appendBlob");
PrefixMatch=@("conpre1","conpre2");
ExcludePrefix=@("expre1","expre2");
IncludeDeleted=$true
})
})
})
})
$policy
StorageAccountName : weiadlscanary1
ResourceGroupName : weitry
Name : DefaultInventoryPolicy
Id : /subscriptions/{subscription-Id}/resourceGroups/weitry/providers/Microsoft.Storage/storageAccounts/weiadlscanary1/inventoryPolicies/default
Type : Microsoft.Storage/storageAccounts/inventoryPolicies
LastModifiedTime : 5/12/2021 9:02:21 AM
Enabled : True
Rules : {Test1, Test2, Test3}
$policy.Rules
Name Enabled Destination ObjectType Format Schedule IncludeSnapshots IncludeBlobVersions IncludeDeleted BlobTypes PrefixMatch ExcludePrefix SchemaFields
---- ------- ----------- ---------- ------ -------- ---------------- ------------------- -------------- --------- ----------- ------------- ------------
Test1 True containername Blob Csv Weekly True True {blockBlob, appendBlob} {prefix1, prefix2} {Name, Content-Length, BlobType, Snapshot...}
Test2 False containername Container Parquet Daily {conpre1, conpre2} {Name, Metadata, PublicAccess}
Test3 False containername Blob Csv Weekly True {blockBlob, appendBlob} {conpre1, conpre2} {expre1, expre2} {Name, Content-Type, Content-Cache, Content-Language...} {name, Metadata, PublicAccess}
Perintah ini membuat atau memperbarui kebijakan inventori blob akun Storage dengan kebijakan format json.
Contoh 3: Dapatkan kebijakan inventori blob dari akun Penyimpanan, lalu atur ke akun Penyimpanan lain.
$policy = Get-AzStorageBlobInventoryPolicy -ResourceGroupName "myresourcegroup" -AccountName "mystorageaccount" | Set-AzStorageBlobInventoryPolicy -ResourceGroupName "myresourcegroup2" -AccountName "mystorageaccount2"
Perintah ini pertama-tama mendapatkan kebijakan inventori blob dari akun Storage, lalu mengaturnya ke akun Storage lain. Proeprties: Tujuan, Diaktifkan, dan Aturan kebijakan akan diatur ke akun tujuan.
Contoh 4: Dapatkan aturan kebijakan inventori blob dari akun Penyimpanan, lalu atur ke akun Penyimpanan lain.
$policy = ,((Get-AzStorageBlobInventoryPolicy -ResourceGroupName "myresourcegroup" -AccountName "mystorageaccount").Rules) | Set-AzStorageBlobInventoryPolicy -ResourceGroupName "myresourcegroup2" -AccountName "mystorageaccount2" -Disabled
Perintah ini pertama-tama mendapatkan kebijakan inventori blob dari akun Storage, lalu mengatur aturannya ke akun Storage lain.
Parameter
-Confirm
Meminta Anda mengonfirmasi sebelum menjalankan cmdlet.
Jenis: | SwitchParameter |
Alias: | cf |
Position: | Named |
Nilai default: | None |
Diperlukan: | False |
Terima input alur: | False |
Terima karakter wildcard: | False |
-DefaultProfile
Kredensial, akun, penyewa, dan langganan yang digunakan untuk komunikasi dengan Azure.
Jenis: | IAzureContextContainer |
Alias: | AzContext, AzureRmContext, AzureCredential |
Position: | Named |
Nilai default: | None |
Diperlukan: | False |
Terima input alur: | False |
Terima karakter wildcard: | False |
-Disabled
Kebijakan Inventori Blob diaktifkan secara default, tentukan parameter ini untuk menonaktifkannya.
Jenis: | SwitchParameter |
Position: | Named |
Nilai default: | None |
Diperlukan: | False |
Terima input alur: | False |
Terima karakter wildcard: | False |
-Policy
Objek Kebijakan Inventaris Blob untuk Diatur
Jenis: | PSBlobInventoryPolicy |
Position: | Named |
Nilai default: | None |
Diperlukan: | True |
Terima input alur: | True |
Terima karakter wildcard: | False |
-ResourceGroupName
Nama Grup Sumber Daya.
Jenis: | String |
Position: | 0 |
Nilai default: | None |
Diperlukan: | True |
Terima input alur: | False |
Terima karakter wildcard: | False |
-Rule
Aturan Kebijakan Inventaris Blob. Dapatkan objek dengan cmdlet New-AzStorageBlobInventoryPolicyRule.
Jenis: | PSBlobInventoryPolicyRule[] |
Position: | Named |
Nilai default: | None |
Diperlukan: | True |
Terima input alur: | True |
Terima karakter wildcard: | False |
-StorageAccount
Objek akun penyimpanan
Jenis: | PSStorageAccount |
Position: | Named |
Nilai default: | None |
Diperlukan: | True |
Terima input alur: | True |
Terima karakter wildcard: | False |
-StorageAccountName
Nama Akun Penyimpanan.
Jenis: | String |
Alias: | AccountName |
Position: | 1 |
Nilai default: | None |
Diperlukan: | True |
Terima input alur: | False |
Terima karakter wildcard: | False |
-StorageAccountResourceId
Id Sumber Daya Akun Penyimpanan.
Jenis: | String |
Position: | 0 |
Nilai default: | None |
Diperlukan: | True |
Terima input alur: | True |
Terima karakter wildcard: | False |
-WhatIf
Menunjukkan apa yang akan terjadi jika cmdlet berjalan. Cmdlet tidak dijalankan.
Jenis: | SwitchParameter |
Alias: | wi |
Position: | Named |
Nilai default: | None |
Diperlukan: | False |
Terima input alur: | False |
Terima karakter wildcard: | False |
Input
Microsoft.Azure.Commands.Management.Storage.Models.PSBlobInventoryPolicySchema