azure-cli

How do I run Azure Cli Script using my local Azure Cli installation

故事扮演 提交于 2019-12-22 06:34:28
问题 First off I feel crazy asking this, sorry if this is a really stupid question. It must be obvious as I have searched everywhere and cannot find an answer! How I am supposed to run this Azure script to create an Azure Function App? https://docs.microsoft.com/en-us/azure/azure-functions/scripts/functions-cli-create-serverless #!/bin/bash # Function app and storage account names must be unique. storageName=mystorageaccount$RANDOM functionAppName=myserverlessfunc$RANDOM # Create a resource group.

How to run Azure CLI commands using python?

╄→гoц情女王★ 提交于 2019-12-18 06:49:30
问题 I want to use Azure CLI to get the list of all the VMs in my resource group. But I want to implement the same using a python script. For example, I will use the following command in Azure CLI to list the VMs in my resource group: " az vm list -g MyResourceGroup " But, I want the python script to do the same, where I just have to incorporate the CLI command in the python program. 回答1: I have been implementing this over the last couple days. The method that @cbehrenberg provides is mostly what

Service principal privileges for app registration creation

自闭症网瘾萝莉.ら 提交于 2019-12-14 03:52:19
问题 I'm using service principal as login item for azure cli. The role of this service principal is "owner". I'm trying to run: az ad app list and az ad app create --display-name "Test application 2" and getting error: Directory permission is needed for the current user to register the application. For how to configure, please refer 'https://docs.microsoft.com/en-us/azure/azure-resource-manager/resource-group-create-service-principal-portal'. Original error: Insufficient privileges to complete the

Azure CLI\Powershell How to exclude requirements

谁都会走 提交于 2019-12-13 03:24:26
问题 So as a continuation of my last question This one. i got this code as a anwser but now i wold like how i could exclude some requirements function Test-AdminPassword { [CmdletBinding()] Param( [Parameter(Position = 0, Mandatory=$true)] [string]$Password, [Parameter(Position = 1)] [int]$Requirements = 5 ) $result = 0 # test length between 12 and 24 if ($Password.Length -in 12..24) { $result++ } # test uppercase if (($Password -creplace '[^A-Z]', '').Length -ge 3) { $result++ } # test lowercase

Azure CLI storage set cors - Unexpected token

[亡魂溺海] 提交于 2019-12-12 17:17:14
问题 I'm trying set CORS as mentioned here but have an error: $ azure storage cors set --blob static --cors [{\"AllowedOrigins\":\"*\",\"AllowedMethods\":\"GET\"}] info: Executing command storage cors set + Setting storage CORS rules for service: blob error: Unexpected token : What's wrong with [{\"AllowedOrigins\":\"*\",\"AllowedMethods\":\"GET\"}] ? 回答1: I believe you're missing MaxAgeInSeconds parameter. If I try without this parameter, I get an error. However the following worked for me: azure

Azure-CLI Blob Storage remove multiple blobs

心已入冬 提交于 2019-12-12 04:56:23
问题 I need to remove multiple files/blobs with the Azure-CLI. But it's not officially supported. So I wrote a for-loop to remove multiple files with the az command. It's look like this: for i in `az storage blob list --container-name $BUCKET --output table | awk '{print $1}'| sed '1,2d' | sed '/^$/d'` ; do if az storage blob delete --name $i --container-name $BUCKET --output table ; then echo "Files inside the bucket (container) ${BUCKET} have been erased" else echo "Unable to erase the files

Azure CLI 2: how to provide parameters in az group depeloyment create command?

随声附和 提交于 2019-12-12 04:31:59
问题 I am using Azure CLI 2.0 on a windows machine and i am trying to create a Docker VM using this Microsoft documentation: az group deployment create --resource-group myResourceGroup \ --parameters '{"newStorageAccountName": {"value": "mystorageaccount"}, "adminUsername": {"value": "azureuser"}, "adminPassword": {"value": "P@ssw0rd!"}, "dnsNameForPublicIP": {"value": "mypublicdns"}}' \ --template-uri https://raw.githubusercontent.com/Azure/azure-quickstart-templates/master/docker-simple-on

Azure Application Insights, how to change daily cap by Azure CLI

最后都变了- 提交于 2019-12-12 04:06:52
问题 I'm trying to change daily cap for data transfer for all my Application Insights on Azure. Is there any way to change it for all of them? I can't find how to do it by using Azure CLI. Thank you. 回答1: You can change the daily cap with the Azure PowerShell cmdlet Set-AzureRmApplicationInsightsDailyCap. Login-AzureRmAccount Set-AzureRmContext -SubscriptionName "Your Sub Name" function Set-DailyCap { $AI = Get-AzureRmApplicationInsights | Select ResourceGroupName, Name $AI | foreach { write

Error fetching vm list using azure cli tools

*爱你&永不变心* 提交于 2019-12-12 03:24:46
问题 I'm using azure tools on mac OS X. I did run following commands : 1. $ azure login 2. $ azure account download 3. $ azure import .publishsettings 4. $ azure account set "subscription id" But now when I run $ azure vm list it shows following error : { [Error: The server failed to authenticate the request. Verify that the certificate is valid and is associated with this subscription.] code: 'ForbiddenError', statusCode: 403 } Error: The server failed to authenticate the request. Verify that the

Azure PostgreSQL: it is not possible to remove database through Azure CLI

时光毁灭记忆、已成空白 提交于 2019-12-11 16:01:46
问题 I have created pipeline using Azure DevOps for Azure PostgreSQL database. What actually pipeline do? Connect to PostgreSQL; Remove database db_test from PostgreSQL using Azure CLI; az postgres db delete -g my_group -s database_here -n db_test --yes However, I cannot do this due to error: An unexpected error occured while processing the request. Then, I was trying to remove the database using psql, but with no luck due to existing connections to database. From my point of view - Azure CLI must