I have wrongly deleted the Log Analytics Workspace and moved the Container App Environment to a new group. After that I found out my Container App Environment had the wrong customerId.
"appLogsConfiguration": {
"destination": "log-analytics",
"logAnalyticsConfiguration": {
"customerId": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
}
},
I tried to change that using the workspace-id using the create command below, but it didn't change. I suppose that workspaceid and customerId are the same, since I checked both.
az containerapp env create \
--name samenameasbefore \
--resource-group newgroup\
--logs-workspace-id newid \
--logs-workspace-key newsecret \
--location westeurope
Is there any documented or undocumented way to change the customerId/workspaceid of a Container App Environment?
Thank you
Short answer, the CAE workspace ID can't be changed. In order to use a specific workspace with a container app you'll need to redeploy it in a CAE that was created with the specific workspace you want to use. Currently there's no CLI command or workaround that would allow for a workspace switch on CAE.
Related
I am attempting to reverse engineer this command so I can move it into Terraform:
az aks create --resource-group "..." --name "..." \
--network-plugin azure \
--enable-managed-identity \
-a ingress-gateway --appgw-name "myAksGateway" --appgw-subnet-id "..." \
--node-vm-size "..." \
--service-cidr "..." \
--vnet-subnet-id "..." \
--docker-bridge-address "..." \
--dns-service-ip "..." \
--generate-ssh-keys
Everything is going fine except for the Application Gateway part.
Is there any way to ask the Azure CLI to do a dry run and simply show me all the creation data it is using?
I looked at az aks create --help but it didn't have a dry run option.
The basics for azurerm_kubernetes_cluster are straight-forward, as is the azurerm_application_gateway; something is off and I want to see what it is doing under the covers to get it just right. There's some differences I am trying to get ironed out and it would be much easier to just see what it's doing.
I can't run az aks create --debug because of resource limits and the basic JSON output on the AKS resource isn't verbose enough for what I am looking for.
You can't get all the creating data from the CLI command even if you use the parameter --debug, it only shows you the REST API behind the CLI command. You can get all the steps to install the AGIC for the AKS cluster here. Then you can transfer all the steps into Terraform.
When using docker compose to deploy a container group to Azure Container Instances, the --location argument specified when creating the docker context for aci, docker context create aci..., appears to have no effect.
I'm following these azure instructions for using docker compose with azure container instances
and this docker documentation showing the additional arguments for the docker context create command
Steps to re-produce
Pre-requisites:
Azure CLI
λ az version
{
"azure-cli": "2.22.1",
"azure-cli-core": "2.22.1",
"azure-cli-telemetry": "1.0.6",
"extensions": {}
}
Docker
λ docker-compose --version
docker-compose version 1.29.0, build 07737305
Docker Compose
λ docker --version
Docker version 20.10.5, build 55c4c88
Steps:
Log into azure via the cli az login
Authenticate docker with azure docker login azure
Create an azure resource group in a specific location az group create -l uksouth -n test-aci-ctx-group
Create a docker context specifying a location different to the resource group location docker context create aci aci-context-eastus --resource-group test-aci-ctx-group --location eastus
Display the information about the new context. docker context inspect aci-context-eastus
Expected result: a context bound to the location specified as --location for the docker context create command, i.e., eastus
Actual result: a context bound to the same location as the azure resource group, i.e., uksouth
λ docker context inspect aci-context-eastus
[
{
"Name": "aci-context-eastus",
"Metadata": {
"Description": "test-aci-ctx-group#uksouth",
"Type": "aci"
},
"Endpoints": {
"aci": {
"Location": "uksouth",
"ResourceGroup": "test-aci-ctx-group",
"SubscriptionID": "xxxxxxxxxxxxxxxxxxx"
},
"docker": {
"SkipTLSVerify": false
}
},
"TLSMaterial": {},
"Storage": {
"MetadataPath": "xxxx",
"TLSPath": "xxxx"
}
}
]
The ultimate manifestation of this issue is that I am unable to create a container group in azure because I'm working in the context of a resource group which I cannot change, but the resource group is in a location that does not support Azure Container Instances.
When I try and issue the docker-compose up command in the aci context that I thought I created in a location that supports azure container instances, I get a location not supported error, listing the location of the resource group and not the location I specified for the docker aci context.
Am I misunderstanding the purpose of the --location parameter?
I know you can mix and match locations between a container instance and a resource group because I am able to create a container instance via azure cli with a location different to that of the resource group that it is linked to.
You misunderstand the steps. The parameter needs to be used like this:
docker context create aci --location "eastus"
So you don't need to create the resource group first. When you do it, then the group is already created with a certain location and you can't change it with the docker-compose command.
You have two choices. One is that create the resource group with the location you want, for example, location "eastus". Or create the resource group with the parameter --location "eastus" without a name.
When I try to deploy an Azure Function to the cloud using... func azure functionapp publish appName --build remote --publish-local-settings
...I receive the following error
Getting site publishing info...
Remote build is a new feature added to function apps.
Your function app appName does not support remote build as it was created before August 1st, 2019.
Please use '--build local' or '--build-native-deps'.
For more information, please visit https://aka.ms/remotebuild
EVEN THOUGH THE APP WAS LITERALLY JUST CREATED IN AZURE PORTAL.
System:
- Running VS Code on Ubuntu 18.04
Steps to reproduce:
Create a new Function App (and support resources) using az cli
Python runtime
Consumption plan
StandardV2 Storage plan
AppInsights
Create new Function (scaffolding) using VS Code Azure Functions extension
Create __init__.py and configure local.settings.json
Open a terminal; cd to Function folder
Run func azure functionapp publish appName --build remote --publish-local-settings
Fails everytime with the message above
Tried so far:
- Substituting --build local.
- Looks like it wants to work, but fails with error
There was an error restoring dependencies. ERROR: cannot install cryptography-2.9.2 dependency: binary dependencies without wheels are not supported when building locally. Use the "--build remote" option to build dependencies on the Azure Functions build server, or "--build-native-deps" option to automatically build and configure the dependencies using a Docker container. More information at https://aka.ms/func-python-publish
Not going to try:
- --build-local-deps because I don't want a docker instance for my Function App
Please advise. This is painful at this point.
In my case, I was provisioning an azurerm_linux_function_app with terraform and got this error. The error turned out to be caused by me forgetting to specify the storage_account_access_key setting. The docs even mention
One of storage_account_access_key or storage_uses_managed_identity must be specified when using storage_account_name.
But terraform does not actually check that when applying your configuration, resulting in a cryptic error message much later in the process.
Here is what was found today:
I initially created the Function App Storage Account with...
# Create a Function App Storage Account
az storage account create \
--name $fa_storage_name \
--resource-group $rg_name \
--access-tier Cool \
--default-action Deny \
--kind StorageV2 \
--subscription $az_sub
--location $az_loc \
--sku Standard_LRS
Changed this to...
# Create a Function App Storage Account
az storage account create \
--name $fa_storage_name \
--resource-group $rg_name \
--location $az_loc \
--sku Standard_LRS
...and was able to get past that error. The way I stumbled onto this was using the --buld local flag. It gave me a MUCH MORE ACCURATE error. Something along the lines of Check your storage account dude.
(thank you Marcelo!)
I have a File Share setup in a Storage Account. When I try to mount it in my Web App I get the following response:
"nexport-shared": {
"accessKey": "hidden==",
"accountName": "hidden",
"mountPath": "\\\\nexportshared",
"shareName": "nexportcampusbetashare",
"state": "InvalidCredentials",
"type": "AzureFiles"
}
I am using the az CLI command below :
az webapp config storage-account add --resource-group "GROUPNAME" --name "WEBAPPNAME" --custom-id nexport-shared --storage-typeAzureFiles --share-name nexportcampusbetashare --account-name STORAGEACCOUNT --access-key "hidden==" --mount-path "\\nexportshared" --verbose --debug
When I run 'az webapp config list' it shows up in the list but still with InvalidCredentials
A possible reason is that you have input an invalid key or storage account to mount the Azure files. Correcting these parameters fixes this issue for me.
Fixed as below
You may need to turn off or modify the firewall on the storage account for the Azure-Cli and the App Service to be able to see it.
I'm getting same response and file share is working as expected.
Also I just found an issue created about this, seems to be an error in the response message from the API:
https://github.com/Azure/azure-cli/issues/21571
I´m using az functionapp create for creating function ap in Azure, where apparts of creating the function app it also hooks it to a bitbucket repo. I´m using parametere --deployment-source-url -u but it seems is not working this way and is giving me an error. This is done by a jenkin file pipeline
node {
stage('Azure Login') {
withCredentials([azureServicePrincipal('6-8afd-ae40e9cf1e74')]) {
sh 'az login --service-principal -u $AZURE_CLIENT_ID -p $AZURE_CLIENT_SECRET -t $AZURE_TENANT_ID'
sh 'az account set -s $AZURE_SUBSCRIPTION_ID'
}
}
stage('Build Azure FuntionApp') {
sh 'az functionapp create -g $RG_NAME -p $SP_NAME -n grey-$JOB_NAME-$BUILD_NUMBER -s $SA_NAME --deployment-source-url https:// bitbucket.org/xxxx/functions/s***strong text***rc/develop --debug'
}
If I put --deployment-source-url -u https://user#bitbucket.org I get:
ERROR: az functionapp create: error: argument
--deployment-source-url/-u: expected one argument
I tried without the -u just : --deployment-source-url https://#bitbucket.org
and the job gets done, but the link with bitbucket repos is not made. Getting this:
So how is it that this work? how come if I put user it says invalid argument and if I don´t it pases but It can find user. Does anyone ever used this command to create a function app? thanks!
If you want to create azure function via azure-cli, you could change the deployment resource url after --deployment-source-url. You could refer to my command to create a function with a blob trigger, replace the url of yours. It works fine on my side.
Note: The Access level should be public, you could check it in Settings like the screenshot below.
az functionapp create --deployment-source-url https://bitbucket.org/xxx/azure-function --resource-group resourcegroupname --consumption-plan-location westeurope --name joyfun22 --storage-account <storage_name>
Besides, you also can use a github repository to create a function.
For example, to use the command below to create a function with a blob trigger.
az functionapp create --deployment-source-url https://github.com/Joyw1/Azure-Function-Trigger --resource-group myResourceGroup --consumption-plan-location westeurope --name <app_name> --storage-account <storage_name>
Update:
If your Access level is private. You need a access token to access your bitbucket repository. Please follow the steps bellow.
1.Go to the Bitbucket Labs -> Access Management -> OAuth -> Add consumer
More details, refer to this link.
2.Enable authenticated git deployment with Azure CLI
#!/bin/bash
gitrepo=<Replace with your GitHub repo URL e.g. https://github.com/Azure-Samples/functions-quickstart.git>
token=<Replace with a GitHub access token>
# Enable authenticated git deployment
az functionapp deployment source update-token \
--git-token $token
For complete command, refer to this link.