Catatan
Akses ke halaman ini memerlukan otorisasi. Anda dapat mencoba masuk atau mengubah direktori.
Akses ke halaman ini memerlukan otorisasi. Anda dapat mencoba mengubah direktori.
Artikel ini menjelaskan cara mengkueri informasi cadangan untuk sumber daya Azure Anda menggunakan Azure Resource Graph (ARG) tanpa biaya tambahan. ARG memperluas Azure Resource Management dan memungkinkan Anda menjelajahi sumber daya secara efisien dan dalam skala besar di beberapa langganan.
Manfaat utama menggunakan Azure Resource Graph untuk metadata cadangan
Manfaat utama menggunakan ARG untuk mengkueri metadata cadangan Anda adalah:
- Kueri sumber daya di seluruh langganan dengan pemfilteran, pengelompokan, dan pengurutan tingkat lanjut menurut properti sumber daya.
- Akses detail pencadangan real-time, termasuk tugas pencadangan aktif.
- Gabungkan data cadangan dengan informasi sumber daya Azure terkait, seperti Komputer Virtual dan Akun Penyimpanan.
Memulai
Untuk mulai mengkueri cadangan Anda menggunakan ARG, ikuti langkah berikut:
Cari Resource Graph Explorer di portal Microsoft Azure. Pilih pilihan yang sama untuk dialihkan ke editor kueri ARG.
Panel kiri menampilkan semua tabel (dan skema terkaitnya) yang tersedia untuk kueri.
- Tabel RecoveryServicesResources berisi sebagian besar catatan terkait cadangan, seperti detail pekerjaan, detail instans cadangan. dan lain sebagainya.
- Tabel Sumber Daya berisi informasi tentang semua Sumber Daya Azure tingkat atas, seperti vault Layanan Pemulihan, Azure Virtual Machines, Akun Penyimpanan, dan sebagainya.
Untuk menjelajahi data di salah satu tabel ini, tulis kueri Kusto di editor kueri lalu klik Jalankan Kueri.
Anda dapat mengunduh output kueri ini sebagai CSV dari Resource Graph Explorer. Anda juga dapat menggunakan kueri ini dalam otomatisasi kustom menggunakan klien otomatisasi apa pun yang didukung oleh ARG, seperti PowerShell, CLI, atau SDK. Anda juga dapat membuat buku kerja kustom di portal Microsoft Azure menggunakan ARG sebagai sumber data.
Catatan
- Pekerjaan Pencadangan/Pemulihan yang berusia hingga 14 hari tersedia di ARG untuk kueri. Jika Anda ingin mengkueri catatan historis, sebaiknya gunakan Log Azure Monitor.
- ARG memungkinkan Anda mengajukan kueri pada sumber daya yang memiliki hak RBAC sesuai dengan yang Anda miliki.
Contoh kueri
Berikut ini adalah beberapa sampel kueri ARG pada data cadangan yang dapat Anda gunakan di dasbor dan otomatisasi kustom.
Mencantumkan semua Azure VM yang telah dikonfigurasi untuk cadangan
RecoveryServicesResources
| where type in~ ('Microsoft.RecoveryServices/vaults/backupFabrics/protectionContainers/protectedItems')
| extend vaultName = case(type =~ 'microsoft.dataprotection/backupVaults/backupInstances',split(split(id, '/Microsoft.DataProtection/backupVaults/')[1],'/')[0],type =~ 'Microsoft.RecoveryServices/vaults/backupFabrics/protectionContainers/protectedItems',split(split(id, '/Microsoft.RecoveryServices/vaults/')[1],'/')[0],'--')
| extend dataSourceType = case(type=~'Microsoft.RecoveryServices/vaults/backupFabrics/protectionContainers/protectedItems',properties.backupManagementType,type =~ 'microsoft.dataprotection/backupVaults/backupInstances',properties.dataSourceSetInfo.datasourceType,'--')
| extend friendlyName = properties.friendlyName
| extend dsResourceGroup = split(split(properties.dataSourceInfo.resourceID, '/resourceGroups/')[1],'/')[0]
| extend dsSubscription = split(split(properties.dataSourceInfo.resourceID, '/subscriptions/')[1],'/')[0]
| extend lastRestorePoint = properties.lastRecoveryPoint
| extend primaryLocation = properties.dataSourceInfo.resourceLocation
| extend policyName = case(type =~ 'Microsoft.RecoveryServices/vaults/backupFabrics/protectionContainers/protectedItems',properties.policyName, type =~ 'microsoft.dataprotection/backupVaults/backupInstances', properties.policyInfo.name, '--')
| extend protectionState = properties.currentProtectionState
| where protectionState in~ ('ConfiguringProtection','ProtectionConfigured','ConfiguringProtectionFailed','ProtectionStopped','SoftDeleted','ProtectionError')
Mencantumkan semua pekerjaan cadangan di Server Azure Database for PostgreSQL dalam satu minggu terakhir
RecoveryServicesResources
| where type in~ ('Microsoft.DataProtection/backupVaults/backupJobs')
| extend vaultName = case(type =~ 'microsoft.dataprotection/backupVaults/backupJobs',properties.vaultName,type =~ 'Microsoft.RecoveryServices/vaults/backupJobs',split(split(id, '/Microsoft.RecoveryServices/vaults/')[1],'/')[0],'--')
| extend friendlyName = case(type =~ 'microsoft.dataprotection/backupVaults/backupJobs',strcat(properties.dataSourceSetName , '/', properties.dataSourceName),type =~ 'Microsoft.RecoveryServices/vaults/backupJobs', properties.entityFriendlyName, '--')
| extend dataSourceType = case(type =~ 'Microsoft.RecoveryServices/vaults/backupJobs',properties.backupManagementType,type =~ 'microsoft.dataprotection/backupVaults/backupJobs',properties.dataSourceType,'--')
| extend backupInstanceName = properties.backupInstanceId
| extend dsResourceGroup = split(split(properties.dataSourceId, '/resourceGroups/')[1],'/')[0]| extend dsSubscription = split(split(properties.dataSourceId, '/subscriptions/')[1],'/')[0]
| extend status = properties.status
| extend dataSourceId = properties.dataSourceId
| extend primaryLocation = properties.dataSourceLocation
| extend jobStatus = case (properties.status == 'Completed' or properties.status == 'CompletedWithWarnings','Succeeded',properties.status == 'Failed','Failed',properties.status == 'InProgress', 'Started', properties.status), operation = case(type =~ 'microsoft.dataprotection/backupVaults/backupJobs' and tolower(properties.operationCategory) =~ 'backup' and properties.isUserTriggered == 'true',strcat('adhoc',properties.operationCategory),type =~ 'microsoft.dataprotection/backupVaults/backupJobs', tolower(properties.operationCategory), type =~ 'Microsoft.RecoveryServices/vaults/backupJobs' and tolower(properties.operation) =~ 'backup' and properties.isUserTriggered == 'true',strcat('adhoc',properties.operation),type =~ 'Microsoft.RecoveryServices/vaults/backupJobs',tolower(properties.operation), '--'),startTime = todatetime(properties.startTime),endTime = properties.endTime, duration = properties.duration
| project id, name, friendlyName, resourceGroup, vaultName, dataSourceType, operation, jobStatus, startTime, duration, backupInstanceName, dsResourceGroup, dsSubscription, status, primaryLocation, dataSourceId
| where (startTime >= ago(7d))
Mencantumkan semua Azure VM yang belum dikonfigurasi untuk cadangan
Resources
| where type in~ ('microsoft.compute/virtualmachines','microsoft.classiccompute/virtualmachines')
| extend resourceId=tolower(id)
| join kind = leftouter ( RecoveryServicesResources
| where type == "microsoft.recoveryservices/vaults/backupfabrics/protectioncontainers/protecteditems"
| where properties.backupManagementType == "AzureIaasVM"
| project resourceId = tolower(tostring(properties.sourceResourceId)), backupItemid = id, isBackedUp = isnotempty(id) ) on resourceId
| extend isProtected = isnotempty(backupItemid)
| where (isProtected == (0))
| project id,name,resourceGroup,location,tags
Daftar semua kebijakan Cadangan yang digunakan untuk Azure VMs
RecoveryServicesResources
| where type == 'microsoft.recoveryservices/vaults/backuppolicies'
| extend vaultName = case(type == 'microsoft.recoveryservices/vaults/backuppolicies', split(split(id, 'microsoft.recoveryservices/vaults/')[1],'/')[0],type == 'microsoft.recoveryservices/vaults/backuppolicies', split(split(id, 'microsoft.recoveryservices/vaults/')[1],'/')[0],'--')
| extend datasourceType = case(type == 'microsoft.recoveryservices/vaults/backuppolicies', properties.backupManagementType,type == 'microsoft.dataprotection/backupVaults/backupPolicies',properties.datasourceTypes[0],'--')
| project id,name,vaultName,resourceGroup,properties,datasourceType
| where datasourceType == 'AzureIaasVM'
Mencantumkan semua VM yang terkait dengan kebijakan cadangan tertentu
RecoveryServicesResources
| where type == "microsoft.recoveryservices/vaults/backupfabrics/protectioncontainers/protecteditems"
| project propertiesJSON = parse_json(properties)
| where propertiesJSON.backupManagementType == "AzureIaasVM"
| project VMID=propertiesJSON.sourceResourceId, PolicyID=propertiesJSON.policyId
| where PolicyID == "<ARM ID of the given policy>"
Mencantumkan semua Kebijakan cadangan yang digunakan untuk Server Azure Database for PostgreSQL
RecoveryServicesResources
| where type in~ ('Microsoft.DataProtection/BackupVaults/backupPolicies')
| extend vaultName = case(type =~ 'microsoft.dataprotection/backupVaults/backupPolicies', split(split(id, '/Microsoft.DataProtection/backupVaults/')[1],'/')[0],type =~ 'microsoft.recoveryservices/vaults/backupPolicies', split(split(id, '/Microsoft.RecoveryServices/vaults/')[1],'/')[0],'--')
| extend datasourceType = case(type =~ 'Microsoft.RecoveryServices/vaults/backupPolicies', properties.backupManagementType,type =~ 'microsoft.dataprotection/backupVaults/backupPolicies',properties.datasourceTypes[0],'--')
| project id,name,vaultName,resourceGroup,properties,datasourceType
| where (datasourceType in~ ('Microsoft.DBforPostgreSQL/servers/databases'))