Azure サーバーのバックアップを毎日作成したい...
そのために私はこのリンクを使用しています:
https://gallery.technet.microsoft.com/scriptcenter/Back-up-an-Azure-VM-using-9545f0a1#content
http://blogs.technet.com/b/cbernier/archive/2014/04/08/microsoft-azure-automation.aspx
1 つのランブック「knsremotepscommand」を手動で作成し、2 つのファイルをインポートしたという点で、1 つの自動化「knsazureautomation」を作成しました。
- Connect-Azure:/scriptcenter/Connect-to-an-Azure-f27a81bb - このスクリプトをダウンロードします
- Connect-AzureVM: /scriptcenter/Connect-to-an-Azure-85f0782c - このスクリプトをダウンロードします
knsremoteps コマンドのワークフロー (>Author>Draft)
workflow knsremotepscommand
{
Param
(
[parameter(Mandatory=$true)]
[String]
$AzureSubscriptionName,
[parameter(Mandatory=$true)]
[PSCredential]
$AzureOrgIdCredential,
[parameter(Mandatory=$true)]
[String]
$ServiceName,
[parameter(Mandatory=$true)]
[String]
$VMName,
[parameter(Mandatory=$true)]
[String]
$VMCredentialName,
[parameter(Mandatory=$true)]
[String]
$PSCommand
)
# Get credentials to Azure VM
$Credential = Get-AutomationPSCredential -Name $VMCredentialName
if ($Credential -eq $null)
{
throw "Could not retrieve '$VMCredentialName' credential asset. Check that you created this asset in the Automation service."
}
# Set up Azure connection by calling the Connect-Azure runbook. You should call this runbook after
# every CheckPoint-WorkFlow to ensure that the management certificate is available if this runbook
# gets interrupted and starts from the last checkpoint
$Uri = Connect-AzureVM -AzureSubscriptionName $AzureSubscriptionName -AzureOrgIdCredential $AzureOrgIdCredential -ServiceName $ServiceName -VMName $VMName
# Run a command on the Azure VM
$PSCommandResult = InlineScript {
Invoke-command -ConnectionUri $Using:Uri -credential $Using:Credential -ScriptBlock {
Invoke-Expression $Args[0]
} -Args $Using:PSCommand
}
$PSCommandResult
}
作成されたアセットは
自動化の作成:
Account Name: KNSAzureAutomation Region:EAST US 2
資産:
接続を追加
Configure connection CONNECTION TYPE:azure NAME: KNSAzureConnection AUTOMATIONCERTIFICATENAME:KNSAzureCertificationName SUBSCRIPTIONID: (my azure subscrption id is given)
認証情報を追加
CREDENTIAL TYPE:WindowsPowerShell Credential NAME:KNSAzureCredential
スケジュールを追加
Configure Schedule NAME:KnsAzureBackup1 DESCRIPTION: first backuschedule everaday at 12.45 SELECTED RUNBOOK KNSremotePScommand AZUREORGIDCREDENTIAL:vnalluri2006@hotmail.com AZURESUBSCRIPTIONNAME:BizSpark PSCOMMAND:ipconfig/all SERVICENAME:KNSWin VMCREDENTIALNAME:KNSAzureCredential(Asset Credential name) VMNAME:knsazurewin1
このエラーが発生しています:
アカウント「3c2455db-035a-477c-b20c-51fd74a586fa」の「vnalluri2006@hotmail.com」という名前の資格情報が見つかりません。
資格情報を変更した場合
AZUREORGIDCREDENTIAL:vnalluri2006@hotmail.com
に
AZUREORGIDCREDENTIAL:KNSAzureCredential
このエラーが発生しています:
4/22/2015 4:53:11 PM, Error: Add-AzureAccount : -Credential parameter can only be used with Organization ID credentials. For more information,
please refer to for more information about the difference
between an organizational account and a Microsoft account.
At Connect-AzureVM:24 char:24
+
+ CategoryInfo : CloseError: (:) [Add-AzureAccount], AadAuthenticationFailedException
+ FullyQualifiedErrorId : Microsoft.WindowsAzure.Commands.Profile.AddAzureAccount
4/22/2015 4:53:12 PM, Error: Select-AzureSubscription : The subscription name BizSpark doesn't exist.
Parameter name: name
At Connect-AzureVM:27 char:27
+
+ CategoryInfo : CloseError: (:) [Select-AzureSubscription], ArgumentException
+ FullyQualifiedErrorId : Microsoft.WindowsAzure.Commands.Profile.SelectAzureSubscriptionCommand
4/22/2015 4:53:17 PM, Error: Get-AzureVM : No default subscription has been designated. Use Select-AzureSubscription -Default <subscriptionName> to
set the default subscription.
At Connect-AzureVM:29 char:29
+
+ CategoryInfo : CloseError: (:) [Get-AzureVM], ApplicationException
+ FullyQualifiedErrorId : Microsoft.WindowsAzure.Commands.ServiceManagement.IaaS.GetAzureVMCommand
4/22/2015 4:53:17 PM, Error: Get-AzureCertificate : Cannot validate argument on parameter 'Thumbprint'. The argument is null or empty. Provide an
argument that is not null or empty, and then try the command again.
At Connect-AzureVM:29 char:29
+
+ CategoryInfo : InvalidData: (:) [Get-AzureCertificate], ParameterBindingValidationException
+ FullyQualifiedErrorId :
ParameterArgumentValidationError,Microsoft.WindowsAzure.Commands.ServiceManagement.Certificates.GetAzureCertificate
4/22/2015 4:53:17 PM, Error: Get-AzureWinRMUri : No default subscription has been designated. Use Select-AzureSubscription -Default
<subscriptionName> to set the default subscription.
At Connect-AzureVM:29 char:29
+
+ CategoryInfo : CloseError: (:) [Get-AzureWinRMUri], ApplicationException
+ FullyQualifiedErrorId : Microsoft.WindowsAzure.Commands.ServiceManagement.IaaS.GetAzureWinRMUri
4/22/2015 4:53:17 PM, Error: Invoke-Command : Cannot validate argument on parameter 'ConnectionUri'. The argument is null, empty, or an element of
the argument collection contains a null value. Supply a collection that does not contain any null values and then try
the command again.
At knsremotepscommand:92 char:92
+
+ CategoryInfo : InvalidData: (:) [Invoke-Command], ParameterBindingValidationException
+ FullyQualifiedErrorId : ParameterArgumentValidationError,Microsoft.PowerShell.Commands.InvokeCommandCommand