I am trying to create a Sql Backup item on a RSV, however I am getting this error for this particular command: Enable-AzRecoveryServicesBackupProtection -Policy $backupPolicy -ResourceGroupName $resourceGroupName -Name $enablename
# Get the Recovery Services Vault details
$vault = Get-AzRecoveryServicesVault -ResourceGroupName $resourceGroupName | Where-Object { $_.Name -eq $rsv }
Set-AzRecoveryServicesVaultContext -Vault $vault
# Wait for some time to ensure the vault context is set (adjust if necessary)
Start-Sleep -Seconds 20
# Get the discovered SQL instances
$containers = Get-AzRecoveryServicesBackupContainer -BackupManagementType AzureWorkload -ContainerType AzureVMAppContainer
$sqlInstance = $containers | Where-Object { $_.FriendlyName -eq $vmName }
if ($sqlInstance -eq $null) {
Write-Output "No SQL instances found in the VM $vmName."
} else {
# Get the backup policy
$backupPolicy = Get-AzRecoveryServicesBackupProtectionPolicy | Where-Object { $_.Name -eq $backupPolicyName -and $_.BackupManagementType -eq "AzureWorkload" }
#$backupPolicy.GetType().FullName
if ($backupPolicy -eq $null) {
Write-Output "Backup policy $backupPolicyName not found."
} else {
# Enable backup protection for the discovered SQL instance
$enablename = $sqlInstance.FriendlyName
Enable-AzRecoveryServicesBackupProtection -Policy $backupPolicy -ResourceGroupName $resourceGroupName -Name $enablename
# Turn on Autoprotect for the discovered SQL instance
Set-AzRecoveryServicesBackupAutoProtection -ResourceGroupName $resourceGroupName -Container $sqlInstance -EnableAutoProtection $true
Write-Output "Backup configuration completed successfully."
}
}
Enable-AzRecoveryServicesBackupProtection -Policy $backupPolicy -ResourceGroupName $resourceGroupName -Name $enablename
or in this manner the same error
Enable-AzRecoveryServicesBackupProtection : The current operation failed due to an internal service error "Invalid input error". Please retry the operation after some time. If the issue persists, please contact Microsoft support.
Enable-AzRecoveryServicesBackupProtection : The current operation failed due to an internal service error "Invalid input error". Please retry the operation
after some time. If the issue persists, please contact Microsoft support.
At line:1 char:1
- Enable-AzRecoveryServicesBackupProtection -Policy $policyToUse -Resou ...
-
+ CategoryInfo : InvalidOperation: (:) [Enable-AzRecove...ackupProtection], CloudException + FullyQualifiedErrorId : CloudInvalidInputError,Microsoft.Azure.Commands.RecoveryServices.Backup.Cmdlets.EnableAzureRmRecoveryServicesBackupProtection
6 answers
Sort by: Most helpful
-
Deleted
This answer has been deleted due to a violation of our Code of Conduct. The answer was manually reported or identified through automated detection before action was taken. Please refer to our Code of Conduct for more information.
Comments have been turned off. Learn more
-
Deleted
This answer has been deleted due to a violation of our Code of Conduct. The answer was manually reported or identified through automated detection before action was taken. Please refer to our Code of Conduct for more information.
Comments have been turned off. Learn more
-
Deleted
This answer has been deleted due to a violation of our Code of Conduct. The answer was manually reported or identified through automated detection before action was taken. Please refer to our Code of Conduct for more information.
Comments have been turned off. Learn more
-
Deleted
This answer has been deleted due to a violation of our Code of Conduct. The answer was manually reported or identified through automated detection before action was taken. Please refer to our Code of Conduct for more information.
Comments have been turned off. Learn more
-
Deleted
This answer has been deleted due to a violation of our Code of Conduct. The answer was manually reported or identified through automated detection before action was taken. Please refer to our Code of Conduct for more information.
Comments have been turned off. Learn more