azure-powershell

Azure DevOps Azure PowerShell task output variable

狂风中的少年 提交于 2020-06-16 06:09:36
问题 I'm creating a release pipeline using one Azure PowerShell Task and PowerShell task. In the the Azure Powershell Task, I have the following code $groupInfos = @() for ([int]$i = 0; $i -lt $azureADGroupsObj.Count) { $groupInfo = New-Object PSObject $groupInfo | Add-Member -MemberType NoteProperty -Name "displayName" -Value $azureADGroupsObj[$i].DisplayName $groupInfo | Add-Member -MemberType NoteProperty -Name "Id" -Value $azureADGroupsObj[$i].Id $groupInfos += $groupInfo $i++ } return

Azure DevOps Azure PowerShell task output variable

落花浮王杯 提交于 2020-06-16 06:05:28
问题 I'm creating a release pipeline using one Azure PowerShell Task and PowerShell task. In the the Azure Powershell Task, I have the following code $groupInfos = @() for ([int]$i = 0; $i -lt $azureADGroupsObj.Count) { $groupInfo = New-Object PSObject $groupInfo | Add-Member -MemberType NoteProperty -Name "displayName" -Value $azureADGroupsObj[$i].DisplayName $groupInfo | Add-Member -MemberType NoteProperty -Name "Id" -Value $azureADGroupsObj[$i].Id $groupInfos += $groupInfo $i++ } return

Issue on executing Invoke-AzureRmVMRunCommand on azure automation

耗尽温柔 提交于 2020-06-13 11:22:50
问题 Trying to run custom script on azure vm through azure automation run-books using Invoke-AzureRmVMRunCommand. But getting below exception InvokeAzureRmVMRunCommand begin processing with ParameterSet 'DefaultParameter'. using account id 'qwerqe-xxxxx-4fde-9f1a-3d4d92ed055c'... System.Management.Automation.Host.HostException: A command that prompts the user failed because the host program or the command type does not support user interaction. The host was attempting to request confirmation with

“Could not find the module Az.Accounts with given version” error when running Azure DevOps job in Docker

江枫思渺然 提交于 2020-05-29 08:23:46
问题 I install PowerShell and Az module in container based on ubuntu:16.04 RUN curl https://packages.microsoft.com/keys/microsoft.asc | apt-key add - && \ wget https://packages.microsoft.com/config/ubuntu/16.04/packages-microsoft-prod.deb && \ dpkg -i packages-microsoft-prod.deb && \ apt-get update -y && \ apt-get install powershell -y && \ pwsh -c "Install-Module -Name Az -Force" It works fine when I ssh to Docker running on my machine, ..but fails with error "Could not find the module Az

How to authenticate an Azure EventGrid API Connection using a script?

房东的猫 提交于 2020-05-28 06:12:48
问题 I am creating an EventGrid API Connection using an ARM Template. It gets created successfully, however, i still have to authenticate it by hand via Azure Portal. Here is my ARM Template: "resources": [ { "type": "Microsoft.Web/connections", "apiVersion": "2016-06-01", "name": "[parameters('azureEventGridConnectionAPIName')]", "location": "[resourceGroup().location]", "properties": { "api": { "id": "[concat(subscription().id, '/providers/Microsoft.Web/locations/', resourceGroup().location, '

Convert multiple PowerShell scripts into an Exe file

笑着哭i 提交于 2020-05-13 14:37:29
问题 I have few powershell script in orders. Can I convert the powershell scripts into one exe file ? I need set up it to run in order. Example, once installing with first script, second script need be installed and followed by 3,4,5 scripts. 回答1: In the simplest case, you can use the following approach to merge your scripts into a single script that you can then package as an executable: $scripts = 'script1.ps1', 'script2.ps1', 'script3.ps1' (Get-Item $scripts | ForEach-Object { "& {{`n{0}`n}}"

Convert multiple PowerShell scripts into an Exe file

萝らか妹 提交于 2020-05-13 14:36:08
问题 I have few powershell script in orders. Can I convert the powershell scripts into one exe file ? I need set up it to run in order. Example, once installing with first script, second script need be installed and followed by 3,4,5 scripts. 回答1: In the simplest case, you can use the following approach to merge your scripts into a single script that you can then package as an executable: $scripts = 'script1.ps1', 'script2.ps1', 'script3.ps1' (Get-Item $scripts | ForEach-Object { "& {{`n{0}`n}}"

Unauthorized access while accessing Azure Cosmos DB to get specific document using Query in power shell

风格不统一 提交于 2020-04-18 06:11:12
问题 With reference to below link, i am trying to modify Github sample to get specific document by providing query option in Body. Link: https://docs.microsoft.com/en-us/rest/api/cosmos-db/querying-cosmosdb-resources-using-the-rest-api Github Sample: https://github.com/Azure/azure-cosmos-dotnet-v3/blob/master/Microsoft.Azure.Cosmos.Samples/Usage/PowerShellRestApi/PowerShellScripts/ReadItem.ps1 I had modified code like below: Add-Type -AssemblyName System.Web Function Generate

Unauthorized access while accessing Azure Cosmos DB to get specific document using Query in power shell

落爺英雄遲暮 提交于 2020-04-18 06:11:05
问题 With reference to below link, i am trying to modify Github sample to get specific document by providing query option in Body. Link: https://docs.microsoft.com/en-us/rest/api/cosmos-db/querying-cosmosdb-resources-using-the-rest-api Github Sample: https://github.com/Azure/azure-cosmos-dotnet-v3/blob/master/Microsoft.Azure.Cosmos.Samples/Usage/PowerShellRestApi/PowerShellScripts/ReadItem.ps1 I had modified code like below: Add-Type -AssemblyName System.Web Function Generate

Unauthorized status while accessing Cosmos Db Collection Documents in power shell

心已入冬 提交于 2020-04-17 20:50:32
问题 I am trying to access azure cosmos db account collection documents and also each document in collection. I had referred below link and changed all necessary cosmos db values like databaseid,container,itemid master key etc., Link: https://github.com/Azure/azure-cosmos-dotnet-v3/blob/master/Microsoft.Azure.Cosmos.Samples/Usage/PowerShellRestApi/PowerShellScripts/ReadItem.ps1 But i am getting below error while running in Powershell. Error: StatusCode: 401 Exception Message: The remote server