Facebook
From Bitty Pudu, 2 Days ago, written in Plain Text.
Embed
Download Paste or View Raw
Hits: 35
  1.     $Conn = Get-AutomationConnection -Name AzureRunAsConnection
  2.     Add-AzureRMAccount -ServicePrincipal -Tenant $Conn.TenantID -ApplicationID $Conn.ApplicationID -CertificateThumbprint $Conn.CertificateThumbprint
  3.    
  4.      Set-AzureRmVMExtension  -ResourceGroupName $RgName `
  5.             -ExtensionName "CreateFile"  `
  6.             -VMName $vm.Name `
  7.             -Publisher Microsoft.Compute `
  8.             -ExtensionType CustomScriptExtension `
  9.             -TypeHandlerVersion 1.8 `
  10.             -SettingString '{"commandToExecute":"powershell Add-Content -Path \"C:\\inetpub\\wwwroot\\Default2.htm\" -Value $($env:computername)"}' -Location westeurope