I'm trying to update RDP login/password on a Service Fabric VMSS. I use the default script proposed here :
https://blogs.technet.microsoft.com/mckittrick/how-to-reset-password-for-vmss-scale-set-instances/
However I have this issue when lauching the last Update-AzureRmVmss command (I don't try to change any zones parameter) :
Update-AzureRmVmss : Changing property 'zones' is not allowed.
ErrorCode: PropertyChangeNotAllowed
ErrorMessage: Changing property 'zones' is not allowed.
StatusCode: 409
ReasonPhrase: Conflict
OperationID : df197d60-0694-4d38-bad6-1de2163de550
At line:13 char:1
+ Update-AzureRmVmss -ResourceGroupName $vmssResourceGroup -Name $vmssN ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Update-AzureRmVmss], ComputeCloudException
+ FullyQualifiedErrorId : Microsoft.Azure.Commands.Compute.Common.ComputeCloudException,Microsoft.Azure.Commands.Compute.Automation.UpdateAzureRmVmss
Any idea ?
thank you
Related
I my trying to connect to a client SFTP server from our Windows Server to pull the files. The connection works fine when trying from my Local machine both using WinSCP application and PowerShell script. But I have to add proxy setting while I am trying to connect from the server which is not the case in Local connection.
While in the server I am able to connect from WinSCP application by enabling proxy setting but fails when I am trying to connect using PowerShell script. I got the custom generated PowerShell script from WinSCP connection.
Below is the code snippet and corresponding error message.
$sessionOptions = New-Object WinSCP.SessionOptions -Property #{
Protocol = [WinSCP.Protocol]::SFTP
HostName = "<host name>"
PortNumber = 22
UserName = "<Username>"
SshPrivateKeyPath= "<private key>"
SshHostKeyFingerprint = "<SshHostKeyFingerprint>"
}
$sessionOptions.AddRawSettings("ProxyMethod", "3")
$sessionOptions.AddRawSettings("ProxyHost", "<proxyhost>")
$sessionOptions.AddRawSettings("ProxyPort", "3128")
$sessionOptions.AddRawSettings("ProxyLocalhost", "1")
getting below error message.
New-Object : The value supplied is not valid, or the property is read-only. Change the value, and then try again.
At line:3 char:19
+ $sessionOptions = New-Object WinSCP.SessionOptions -Property #{
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidData: (:) [New-Object], Exception
+ FullyQualifiedErrorId : SetValueException,Microsoft.PowerShell.Commands.NewObjectCommand
You cannot call a method on a null-valued expression.
At line:12 char:1
+ $sessionOptions.AddRawSettings("ProxyMethod", "3")
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (:) [], RuntimeException
+ FullyQualifiedErrorId : InvokeMethodOnNull
You cannot call a method on a null-valued expression.
At line:13 char:1
+ $sessionOptions.AddRawSettings("ProxyHost", "<proxyhost>")
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (:) [], RuntimeException
+ FullyQualifiedErrorId : InvokeMethodOnNull
You cannot call a method on a null-valued expression.
At line:14 char:1
+ $sessionOptions.AddRawSettings("ProxyPort", "3128")
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (:) [], RuntimeException
+ FullyQualifiedErrorId : InvokeMethodOnNull
You cannot call a method on a null-valued expression.
At line:15 char:1
+ $sessionOptions.AddRawSettings("ProxyLocalhost", "1")
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (:) [], RuntimeException
+ FullyQualifiedErrorId : InvokeMethodOnNull
The most probable explanation is that the value of SessionOptions.SshHostKeyFingerprint is invalid, no other property in your code is validated.
See also WinSCP .NET assembly in PowerShell - Creating SessionOptions - The value supplied is not valid, or the property is read-only
As your fingerprint format seems correct, but as it is a "modern" ssh-ed25519 key, I assume that you have an old version of WinSCP .NET assembly that does not accept this key. You have probably used newer version of WinSCP (the GUI) to obtain this key, but your version of .NET assembly does not accept it. Make sure you use the latest version of the assembly.
I'm trying to create an access policy so that I can create meetings using Microsoft Graph API on the user's behalf. To do this I need to do a script that is similar to this:
Connect-MicrosoftTeams
New-CsApplicationAccessPolicy -Identity Random -AppIds "applicationid" -Description "Users"
Grant-CsApplicationAccessPolicy -PolicyName Random -Identity "userId"
But when I try to run the second line I get this error:
At C:\Program Files\WindowsPowerShell\Modules\MicrosoftTeams\2.3.1\net472\SfBORemotePowershellModule.psm1:63 char:22
+ $remoteSession = & (Get-CsOnlineSessionCommand)
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Get-CsOnlineSession], UnauthorizedAccessException
+ FullyQualifiedErrorId : UnauthorizedAccessException,Microsoft.Teams.ConfigApi.Cmdlets.GetCsOnlineSession
Invoke-Command : Cannot validate argument on parameter 'Session'. The argument is null or empty. Provide an argument that is
not null or empty, and then try the command again.
At C:\Program Files\WindowsPowerShell\Modules\MicrosoftTeams\2.3.1\net472\SfBORemotePowershellModule.psm1:22959 char:38
+ ... -Session (Get-PSImplicitRemotingSession -CommandName 'New-CsApplic ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidData: (:) [Invoke-Command], ParentContainsErrorRecordException
+ FullyQualifiedErrorId : ParameterArgumentValidationError,Microsoft.PowerShell.Commands.InvokeCommandCommand
I'm guessing it has something to do with the first command that it's not remembering my login, but I can't find anywhere on how to do this. Does anyone know what I'm doing wrong and what the correct way is?.
Edit:
I finished the first problem. I needed to create an account on the active directory itself because Microsoft accounts weren't allowed. But my second error is still here:
Invoke-Command : Cannot validate argument on parameter 'Session'. The argument is null or empty. Provide an argument that is
not null or empty, and then try the command again.
At C:\Program Files\WindowsPowerShell\Modules\MicrosoftTeams\2.3.1\net472\SfBORemotePowershellModule.psm1:22959 char:38
+ ... -Session (Get-PSImplicitRemotingSession -CommandName 'New-CsApplic ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidData: (:) [Invoke-Command], ParentContainsErrorRecordException
+ FullyQualifiedErrorId : ParameterArgumentValidationError,Microsoft.PowerShell.Commands.InvokeCommandCommand
Is there a way to set the session via a parameter or is this something you need to do outside this method?
Object reference not set to an instance of an object.
Error when running command Get-AzureRmRecoveryServicesAsrRecoveryPlan...
PS C:\WINDOWS\system32> $rpname = "myrecoveryplan"
$recoplan = Get-AzureRmRecoveryServicesAsrRecoveryPlan -Name $rpname
Get-AzureRmRecoveryServicesAsrRecoveryPlan : Operation failed.
Object reference not set to an instance of an object.
At line:2 char:13
+ $recoplan = Get-AzureRmRecoveryServicesAsrRecoveryPlan -Name $rpname
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : CloseError: (:) [Get-AzureRmReco...AsrRecoveryPlan], Exception
+ FullyQualifiedErrorId : Microsoft.Azure.Commands.RecoveryServices.SiteRecovery.GetAzureRmRecoveryS
ervicesAsrRecoveryPlan
I have updated My powershell and it seems moving on. But I got another blocker. $Context= Set-AzureRmRecoveryServicesAsrVaultContext -Vault $Vault
$recoplan = Get-AzureRmRecoveryServicesAsrRecoveryPlan -Name $rpname
Start-AzureRmSiteRecoveryTestFailoverJob -RecoveryPlan $recoplan -Direction "PrimaryToRecovery" -VMNetwork "asrtestfailtarget"
Start-AzureRmSiteRecoveryTestFailoverJob : Cannot bind parameter 'RecoveryPlan'. Cannot convert the
"Microsoft.Azure.Commands.RecoveryServices.SiteRecovery.ASRRecoveryPlan" value of type
"Microsoft.Azure.Commands.RecoveryServices.SiteRecovery.ASRRecoveryPlan" to type
"Microsoft.Azure.Commands.SiteRecovery.ASRRecoveryPlan".
At line:5 char:56
+ ... rt-AzureRmSiteRecoveryTestFailoverJob -RecoveryPlan $recoplan -Direct ...
+ ~~~~~~~~~
+ CategoryInfo : InvalidArgument: (:) [Start-AzureRmSiteRecoveryTestFailoverJob], Parameter
BindingException
+ FullyQualifiedErrorId : CannotConvertArgumentNoMessage,Microsoft.Azure.Commands.SiteRecovery.Start
AzureRmSiteRecoveryTestFailoverJob
While trying to encrypt a VM, I am getting the below error:
Set-AzureRmVMDiskEncryptionExtension : Long running operation failed
with status 'Failed'. ErrorCode: VMExtensionProvisioningError
ErrorMessage: VM has reported a failure when processing extension
'AzureDiskEncryptionForLinux'. Error message: "Enable failed.".
StartTime: 11/15/2017 11:12:30 AM EndTime: 11/15/2017 11:14:38 AM
OperationID: 004051ca-bf73-4a37-a145-5e0ac30bc30a Status: Failed At
line:1 char:1
+ Set-AzureRmVMDiskEncryptionExtension -ResourceGroupName $resourceGrou ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : CloseError: (:) [Set-AzureRmVMDiskEncryptionExtension], ComputeCloudException
+ FullyQualifiedErrorId : Microsoft.Azure.Commands.Compute.Extension.AzureDiskEncryption.SetAzureDiskEncryptionExtensionCommand
Please help me to resolve this issue.
I was also having the same issue. The reason was i was not changing the access policy of the key vault.
use this command to change the access policy first and then execute the command for encryption.
Set-AzureRmKeyVaultAccessPolicy -VaultName $KeyVaultName -ResourceGroupName $rgName -EnabledForDiskEncryption
and then check the policy with the following command
(Get-AzureRmKeyVault -VaultName $keyVaultName -ResourceGroupName $rgName).EnabledForDiskEncryption it should return true.
We are trying to setup a machine for PSRemoting using the following command
Set-PSSessionConfiguration -Name Microsoft.PowerShell -showSecurityDescriptorUI
for some reason this only works when we open the powershell in the context of a domain user who is a local administrator.
PS C:\Windows\system32> Set-PSSessionConfiguration -Name Microsoft.PowerShell -showSecurityDescriptorUI
Confirm
Are you sure you want to perform this action?
Performing operation "Set-PSSessionConfiguration" on Target "Name:
Microsoft.PowerShell".
[Y] Yes [A] Yes to All [N] No [L] No to All [S] Suspend [?] Help
(default is "Y"):A
Access is denied.
At line:15 char:26
+ if ((!$pluginName) -or <<<< !(test-path "$pluginDir"))
+ CategoryInfo : InvalidOperation: (:) [], InvalidOperationExcept
ion
+ FullyQualifiedErrorId : WsManError
Join-Path : Access is denied.
At line:22 char:35
+ $pluginFileNamePath = Join-Path <<<< "$pluginDir" 'FileName'
+ CategoryInfo : NotSpecified: (:) [Join-Path], InvalidOperationE
xception
+ FullyQualifiedErrorId : System.InvalidOperationException,Microsoft.Power
Shell.Commands.JoinPathCommand
Test-Path : Cannot bind argument to parameter 'Path' because it is an empty str
ing.
At line:23 char:19
+ if (!(test-path <<<< "$pluginFileNamePath"))
+ CategoryInfo : InvalidData: (:) [Test-Path], ParameterBindingVa
lidationException
+ FullyQualifiedErrorId : ParameterArgumentValidationErrorEmptyStringNotAl
lowed,Microsoft.PowerShell.Commands.TestPathCommand
Get-Item : Cannot bind argument to parameter 'LiteralPath' because it is an emp
ty string.
At line:29 char:43
+ $pluginFileName = get-item -literalpath <<<< "$pluginFileNamePath"
+ CategoryInfo : InvalidData: (:) [Get-Item], ParameterBindingVal
idationException
+ FullyQualifiedErrorId : ParameterArgumentValidationErrorEmptyStringNotAl
lowed,Microsoft.PowerShell.Commands.GetItemCommand
Set-PSSessionConfiguration : Session Configuration "Microsoft.PowerShell" is no
t a PowerShell based shell.
At line:89 char:27
+ Set-PSSessionConfiguration <<<< $args[0] $args[1] $args[2] $args[3] $args[4]
$args[5] $args[6] $args[7] $args[8]
+ CategoryInfo : NotSpecified: (:) [Write-Error], WriteErrorExcep
tion
+ FullyQualifiedErrorId : Microsoft.PowerShell.Commands.WriteErrorExceptio
n,Set-PSSessionConfiguration
PS C:\Windows\system32>
it looks to me that there is something that is preventing access to the wsman:\localhost\plugin but can't understand how that can be fixed. This only happens in our test bed, but in our development environment we have no such issues.
Does any one have any clue as to what additional user access is for this command to work that an local administrator user may not have?
Here is an article that explains how to resolve this problem... basically to fix this you set LocalAccountTokenFilterPolicy to True in the registry.
http://www.shirmanov.com/2011/04/winrm-access-is-denied-on-local.html