Deployment of Logic Apps Integration Account with PowerShell error - powershell

I use the powershell New-AzureRmIntegrationAccountSchema to deploy a schema to an integration account.
It worked in the past but now I have this error :
Unable to deserialize the response.
Unfortunately I don't have more details on the issue.
Any ideas?

I set the PowerShell version to 2.1.0 in the Release Pipeline and now it works :)

For your issue, I suggest you could test your xml file on Azure Portal to know whether this is a Power Shell issue or your xml issue.
If your xml works fine on Azure Portal. You could check your Azure Power Shell version with following cmdlet.
Get-Module -ListAvailable -Name Azure -Refresh
I test on 4.4.1 version, it works for me. You could download the msi installer from the link.
If it also does not work, you could add $DebugPreference="Continue" to print more debug log.
Update:
It is a Power Shell version issue, OP use older version Power Shell, when set the Power Shell version to 2.1.0, the issue is resolved. I test in my lab, if we use the latest version, the cmdlet also works.

Related

Azure DevOps PowerShell task fails to load 'Az.CosmosDB' module

I have an Azure DevOps pipeline to rotate Cosmos DB account keys. To do this, I'm using PowerShell and the New-AzCosmosDBAccountKey cmdlet.
For some unknown reason, the Az.CosmosDB module is not installed with Az, so it needs to be installed manually each time the pipeline is run.
Install-Module -Name Az.CosmosDb -AllowClobber -Force
When I run this locally everything works as expected, but within Azure DevOps I see an error
The 'Get-AzCosmosDBAccountKey' command was found in the module 'Az.CosmosDB', but the module could not be loaded.
What might be happening in Azure DevOps that differs from what is happening locally?
The answer here is that an update was made to the Az.CosmosDb module so that it specifically requires version 1.9.4 (or higher) of Az.Accounts. However, on the Azure DevOps hosted agent they use version 1.9.3.
To fix, I changed the command that manually installs the Az.CosmosDb module -
Install-Module -Name Az.CosmosDb -RequiredVersion 0.1.6 -AllowClobber -Force
Note
When I found on the PowerShell Gallery that all versions of the Az.CosmosDb module were < 1.0.0 I did some investigation and it turns out that the module is still in preview, despite Cosmos DB having existed for years. This explains why the module is not installed along side all other Az.* modules when installing Az.
What is very frustrating is that there is no mention anywhere on the documentation for the module that it is in preview. If there were, it would probably have saved me a good chunk of time!
Please check when you run DevOps Pipeline, which agent pool you are using. If you use microsoft-hosted agent, each time you run a pipeline, you get a fresh virtual machine. The virtual machine is discarded after one use. So you need to install the Az.CosmosDB module manually each time.
You could also deploy an agent on your local machine, in this way, it's supposed not need to nstall the Az.CosmosDB module manually each time.
https://learn.microsoft.com/en-us/azure/devops/pipelines/agents/agents?view=azure-devops&tabs=browser
Seems today Azure DevOps finally broke everything, old variant with
Install-Module Az.CosmosDB -RequiredVersion 0.1.6 -Force
has stopped working. Amazing, the whole experience with Az DevOps and Azure technologies are pretty the same, each time they just suddenly have stopped working at random places!
UPD: The gallery source address is dead https://www.powershellgallery.com/packages/Az.CosmosDB/0.1.6 , looks that is the reason

Specific version of Powershell in a Docker image for testing

Anyone know how I can get a build of Windows with Powershell 2.0 running in a Docker container for testing? I've looked at all the official images from MS and none of them seem to have support for it. I have a client I'm helping with getting away from their old machines, but I have to write some scripts that will be run in the old environment (PS 2.0).
I don't know about specific Docker image, but you can use Powershell 2.0 simply by running powershell.exe -version 2 with latest Windows 10 for example.
Reference.
Found a link to a Windows Server image with Net Framework 3 installed, which has Powershell v2 included. Using the command from #Niklas above, I now have a working Powershell v2.0 environment for testing! See below for the docker image link.
https://stackoverflow.com/a/59525183/5445457

AzurePS System capability is not available on a newly installed vsts-agent

I have successfully installed a new VSTS agent on a new Azure VM - Windows Server 2012 R2 (64bit). When I am try to execute any pipelines containing azure powershell tasks on the new vsts agent, I get an error message :-
Error message 'No agent found in pool BuildAgent2 which satisfies the specified demands:azureps Agent.Version -gtVersion 2.119.1'
Is there any way to add AzurePS as a system capability ?
Please advise on the steps to do this - thanks.
AzurePS System capability is not available on a newly installed vsts-agent
Agree with jessehouwing.
If you want to enable AzurePS System capability, you could install the PowerShell 5.1 or higher on Windows, or PowerShell Core 6.x and later on all platforms, then install/update the Azure PowerShell module on the Azure VM:
Install the Azure PowerShell module
But the error you got should more related to the demands you set on the option tab of your build :
Check the agent version you have installed, make sure you set the correct version, or you can try to remove that demands to check if you still have this issue.
Hope this helps.
I got the same error using the AzureFileCopy#4 task in a self-hosted agent, but I solved it by installing the az module https://www.powershellgallery.com/packages/Az
Install-Module -Name Az

install Sitecore update packages with Powershell

We create Sitecore .update packages using TDS and Visual Studio. The update packages can be installed using /sitecore/admin/updateinstallationwizard.aspx. Is there a way to install these packages using Powershell?
Thanks
It depends on the tooling you want to use.
If you can work with Sitecore PowerShell Extensions, it has a convenient Install-UpdatePackage cmdlet (not the Install-Package - this one works with regular Sitecore packages exclusively) that can deploy them in your environment. You can read more about it in our GitBook
You can also create those using the Get-UpdatePackageDiff and Export-UpdatePackage if you do not have access to TDS.
Now to do this on the server directly that's just something that you would run from the Web UI using SPE ISE, but to upload those from your dev environment you can utilise the SPE Remoting again as described in this Gitbook page
If you don't have or want to have SPE deployed on your server you can utilise Sitecore Ship and automate that in Windows PowerShell without the use of Sitecore PowerShell Extensions. The functionality of Sitecore Ship module is limited to doing the task of deploying Sitecore Update packages but this might be just what you want.
You can use for Sitecore Powershell command:
Install-Package [[-Path] ] [-InstallMode ] [-MergeMode ]
More details can be found here:
https://sitecorepowershell.gitbooks.io/sitecore-powershell-extensions/content/appendix/commands/Install-Package.html

Is it possible to upgrade Azure Powershell (ISE) in Windows Server 2012 R2 without reinstalling?

I'm running Windows Server 2012 R2 in an Azure VM in which I have an older version of Azure Powershell (ISE) - when I run . I searched for instructions on how to update Azure Powershell (ISE) but all I'm finding is on how to install from scratch per http://azure.microsoft.com/en-us/documentation/articles/install-configure-powershell/
Is there a way to upgrade without having to re-import the Azure subscription publish-settings file etc ?
By the way, an easy way to find out what version I'm on would be great. Doing get-module azure or get-module does not give me version info per http://cropme.ru/fc7037d19a74cd0db256c52142d9b98a
After you upgrade the Azure PowerShell module, you can just run Add-AzureAccount to update your subscription settings.