azure-powershell

How to collect the Azure VM auto-shutdown time using PowerShell?

不想你离开。 提交于 2019-12-11 16:44:48
问题 I need to collect the Azure VM auto-shutdown time using PowerShell, but don't know how to get to the necessary resource property so the auto-shutdown time is reflected. I am getting the following output: ID: /subscriptions/12345/resourceGroups/W12RG/providers/Microsoft.Compute/virtualMachines/W12 Name ResourceGroupName ResourceType Location ---- ----------------- ------------ -------- shutdown-computevm-W12 W12RG Microsoft.DevTestLab/schedules eastus1 # Retrieve the resource group information

New-AzureSBAuthorizationRule error when creating authorization for a Service Bus Queue

孤人 提交于 2019-12-11 16:17:40
问题 I use New-AzureSBAuthorizationRule to create a new Shared Access Policy for an Azure Service Bus Queue. See command below... New-AzureSBAuthorizationRule -EntityName abcdef -EntityType Queue -Permission Listen -Name "abcdef_reader" -Namespace abcdefnamespace But every time I run this I get the error below: New-AzureSBAuthorizationRule : Object reference not set to an instance of an object. At line:1 char:1 + New-AzureSBAuthorizationRule -EntityName abcdef -EntityType Queue -Permission ... + ~

Get-Command : The term 'Get-AzStorageBlobContent' is not recognized as the name of a cmdlet, function, script file, or operable program

ε祈祈猫儿з 提交于 2019-12-11 15:30:04
问题 From my question about installing Azure Powershell I was able to install Azure Powershell 5.1 However when I try to run Get-Command Get-AzStorageBlobContent I get Get-Command : The term 'Get-AzStorageBlobContent' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again. At line:1 char:1 + Get-Command Get-AzStorageBlobContent + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

How to run Azure cmdlets from a powershell script in a published Web Role VS2012 project

别来无恙 提交于 2019-12-11 13:42:25
问题 I have a VS 2012 MVC 4 web role project and I successfully call a powershell script from the bin directory of the role, after I run Set-ExecutionPolicy Unrestricted from a startup cmd. The script contains some azure cmdlets and when I run the project locally the script works perfectly. However when I publish the project on Azure, the same azure cmdlets in the script do not run. For example: param([string]$websiteName="itudkcloudqwerdfs", [string]$serverLogin="user", [string]$serverPass=

Double hopping credentials from VSTS through Azure PowerShell script to PowerShell script on target VM

守給你的承諾、 提交于 2019-12-11 13:36:27
问题 I need to automate execution of scripts on target VMs as a domain administrator. The problem is, VMs don't have public. I also should not rewrite the script as it has been written by a team member and I'd rather provide my team with a solution that works for them and is automatable, instead of rewriting their scripts every time. The current process looks like thi VSTS initiates a build process with Azure PowerShell script command1.ps1 Command1.ps1 installs Azure Custom Script Extension on the

Get-AzureBlobContent throwing error when run from Azure Automation account

谁说我不能喝 提交于 2019-12-11 11:59:23
问题 I am receiving a failure while trying to download blob (JSON file) from Azure storage account from my Azure Automation account. It looks like an authorization issue. This works on my local laptop, but does not work on Azure Automation Account. Does not work even if I make the container "public" I have assigned OWNER privileges for the Automation accounts's service principle on the Resource Group (Automation account + Storage account stay in this RG) and specifically on the Storage Account as

Azure Powershell - Az module not working on Ubuntu hosted build agent

大城市里の小女人 提交于 2019-12-11 11:58:46
问题 I have a build running in Azure DevOps, on an Ubuntu 16.04 hosted build agent. I'm using the latest version of the "Azure Powershell" task (version 4.* preview), which is supposed to be multi-platform, support Powershell core, and support using the Azure Powershell Az module. However, it doesn't quite work. Before running any of my script, it errors out with: ##[section]Starting: Azure PowerShell script: InlineScript ============================================================================

VSTS Release Azure Powershell task fails when calling New-AzureStorageTable cmdlet

旧街凉风 提交于 2019-12-11 11:41:06
问题 I am building a release pipeline which creates and populates a table in Azure Table Storage if it doesn't yet exist. My Powershell file runs locally on my machine, but when I check it in to VSTS and execute it in the Release pipeline in an 'Azure Powershell' step it fails. Here is the relevant script from the ps1 file: $ctx = New-AzureStorageContext -StorageAccountName $storageAccountName -StorageAccountKey $storageAccountKey $table = Get-AzureStorageTable -Name $tableName -Context $ctx

How to read and set DevOps Pipeline variables using Azure PowerShell?

ε祈祈猫儿з 提交于 2019-12-11 09:07:32
问题 I have an Azure Pipeline setup with MyVariable variable defined: How do I write Azure PowerShell Inline Script to read the variable, and set it to a value after some processing? 回答1: Reading : Variables are exposed as environment-variables, to read the variable "TestVar" you can do this: $myScriptVariable = $env:TESTVAR Note that "." will be replaced with "_" and all is uppercase. Setting or Updating: To set or update a variable you'll have to write following 'command' to the host with "write

How to read text in .txt file and each of its value in powershell?

笑着哭i 提交于 2019-12-11 09:02:23
问题 I have data in a text file like below, i want to read it value by value using powershell Name Enabled Description ---- ------- ----------- administrator1 True Azureuser True Built-in account for administering the computer/domain DefaultAccount False A user account managed by the system. Guest False Built-in account for guest access to the computer/domain For example i want to read value for name in 2nd field. How can it be read? 回答1: It is difficult to convert it without having a delimiter in