Does connection string of application insight change by any action in Azure? - azure

Does app insight connection string change by itself or by any action which cause changing in it?
InstrumentationKey=xxxxxxxxxxxxx;IngestionEndpoint=https://westus-8.in.applicationinsights.azure.com/;LiveEndpoint=https://westus.livediagnostics.monitor.azure.com/
Here we observing in IngestionEndpoint that westus-8 is changing to westus-7 or westus-9 by some action in code or somewhere or byitself (maybe)
Can you please let me know whether could it be possible?
just a query? whether could it be possible ? if yes, then what are the actions causing change in app insight's connection string

Does app insight connection string change by itself or by any action which cause changing in it?
IngestionEndpoint that westus-8 is changing to westus-7 or westus-9 by some action in code or somewhere or byitself
No, we can't change the IngestionEndpoint in Application Insights. Once configured our Application with Application Insights We cannot change the Connection String information of Application Insights.
To change the connection string information, use the below work around.
Before changing connection string
Changing Connection String of Application Insights using Az Cli
$Resource_Group_Name = "<Resource Group>"
$App_Insights_Name = "<App Insights Name>"
$Fun_App_Name = "<Function name>"
$Key_Conn = az resource show -g $Resource_Group_Name -n $App_Insights_Name --resource-type "microsoft.insights/components" --query properties.ConnectionString
#Delete the app settings in function app
az functionapp config appsettings delete --name $Fun_App_Name --resource-group $Resource_Group_Name --setting-names "APPLICATIONINSIGHTS_CONNECTION_STRING"
#set the application insight for function app
az functionapp config appsettings set --name $Fun_App_Name --resource-group $Resource_Group_Name --settings "APPLICATIONINSIGHTS_CONNECTION_STRING = $key_Conn"
After Added Connection String in APP Settings

Related

How can i retrieve Azure app service certificate details using powershell?

I am trying to retrieve app service certificate details , but it only retrieves for the entire ResourceGroup using powershell as follows:
az webapp config ssl list --resource-group "TestResourceGroup" | ConvertFrom-Json
There are a number of app services in this resource group. I want the certificate details for a certain app service not all .
How can i get the details for a particular app service ?
You can try using az webapp config ssl show --resource-group <RG_val> --certificate-name <naked_FQDN> (not sure what you need to return). Or alternatively use a JMESPath on the az webapp config list to control what you are returning.
Thanks #mklement0, I have reproduced in my environment and got expected results as below and I followed Microsoft-Document:
$r=az webapp config ssl list --resource-group XX
$r.WebAppName.Certificate
$r | ConvertFrom-Json
XX- Name of the resource group

Problem updating AppGw when WAF Policy is assigned : ApplicationGatewayWafConfigurationCannotBeChangedWithWafPolicy

While trying to update an application gateway (to add a backend pool), using the following command :
az network application-gateway address-pool create --gateway-name "***" --resource-group "***" --servers "***" --name "***"
I get the following error
(ApplicationGatewayWafConfigurationCannotBeChangedWithWafPolicy) WebApplicationFirewallConfiguration cannot be changed when there is a WAF Policy /subscriptions/***/resourceGroups/***/providers/Microsoft.Network/ApplicationGatewayWebApplicationFirewallPolicies/*** associated with it.
Code: ApplicationGatewayWafConfigurationCannotBeChangedWithWafPolicy
Message: WebApplicationFirewallConfiguration cannot be changed when there is a WAF Policy /subscriptions/***/resourceGroups/***/providers/Microsoft.Network/ApplicationGatewayWebApplicationFirewallPolicies/*** associated with it.
I did a similar change a few days ago and I didn't get any error.
I tried doing the change in the Portal and I get the same error.
I tried disabling the WAF rule but I get the same error.
Any clue? Thanks for your help!
(ApplicationGatewayWafConfigurationCannotBeChangedWithWafPolicy)WebApplicationFirewallConfiguration cannot be changed when there is a WAF Policy/subscriptions//resourceGroups//providers/Microsoft.Network/ApplicationGatewayWebApplicationFirewallPolicies/associated with it. Code:ApplicationGatewayWafConfigurationCannotBeChangedWithWafPolicy Message: WebApplicationFirewallConfiguration cannot be changed when there is a WAF Policy
/subscriptions//resourceGroups//providers/Microsoft.Network/ApplicationGatewayWebApplicationFirewallPolicies/ associated with it.
The error occurs could be because some parameters related to the WAF policy are missing from the Application Gateway configuration.
1. `$SubscriptionId = 'xxxxxx-xxxx-xxx'`
2. `$ResourceGroupName = 'RGname'`
3. `$GatewayName = 'appgwname'`
4. `Connect-AzAccount -Subscription $SubscriptionId`
5. `$appGw = Get-AzApplicationGateway -ResourceGroupName $ResourceGroupName -Name $GatewayName`
6. `$appGw.FirewallPolicy = $null`
7. `$appGw.Sku.Name = 'Standard_v2'`
8. `$appGw.Sku.Tier = 'Standard_v2'`
9. `$appGw.WebApplicationFirewallConfiguration = $null`
10. `$appGW.ForceFirewallPolicyAssociation = $true`
11. `Set-AzApplicationGateway -ApplicationGateway $AppGw`
Once you finish updating the Application Gateway using the above script. you can also be able update the backend pools of application gateway by using below commands:
az network application-gateway address-pool create --resource-group <resoruce group > --gateway-name <app-gate-name> --name MyAddressPool1 --servers <address>
I tried in my environment it is successfully updated:
Following that, you can use the Azure portal to switch the Application Gateway SKU back to WAF V2 and attach the WAF policy to it.
Reference:
Cannot renew Certificate in Azure Application Gateway with WAF - Microsoft Q&A by GitaraniSharmaMSFT-4262

Azure CLI - Setting Incoming Client Certificates to Allowed for a Web App

I'm trying to use the Azure CLI to update the Incoming Client Certificate option under Web App > Configuration > General Settings > Incoming Client Certificates to use the value Allow.
Currently I can only set the value to true/false which correlates to Require/Ignore.
az webapp update --set clientCertEnabled=true--name MyWebApp --resource-group MyRsGrp
I haven't been able to find anything in the reference documentation.
https://learn.microsoft.com/en-us/cli/azure/webapp?view=azure-cli-latest#az_webapp_update
Does anyone have a nifty way to configure this setting? Thanks!
To set it to Allow, there are two properties need to be set, clientCertEnabled and clientCertMode, clientCertMode is not available in command az webapp update, you need to use az resource update.
Just use the command below, it works for me.
az resource update --name <webapp-name> --resource-group <group-name> --namespace Microsoft.Web --resource-type sites --set properties.clientCertEnabled=true properties.clientCertMode=Optional

Disable Azure function via AzureCLI does not disable function

I have a function app in Azure that has several functions defined. According to this document, I can use AzureCLI to disable a function in a function app. When I run az functionapp config appsettings set --name $functionAppName --resource-group $resourceGroupName --settings AzureWebJobs.myFunction.Disabled=true it creates the name value pair in application settings as stated in the documentation, but the state of the function does not toggle according to the value I set. Is something else required to toggle the state of the function when I run the AzureCLI commmand?
According to the comments, the problem was solved. OP change the azure function runtime from 1.x to 2.x and then it can be disabled by running this command.
az functionapp config appsettings set --name $functionAppName --resource-group $resourceGroupName --settings AzureWebJobs.myFunction.Disabled=true
Update1:
Update2:
For this problem, I confirmed with azure support team. They provided me with the response below:
They found the feature of az function app config part was released at Sep. 2018, and at that time runtime v1 was already quite out of date. So it is possible that the product team only develops for the runtime v2.
In a word, we can just do this operation on v2 and v3, or use Azure Portal UI.
For the guys who use the runtime 1.x but wanna enable/disable function by Azure CLI. According to the document, it shows:
So the workflow is:
Click APP Service Editor.
Comment out disabled field on function.json.
Run below command again.
az functionapp config appsettings set --name $functionAppName --resource-group $resourceGroupName --settings AzureWebJobs.myFunction.Disabled=true
This function will reference the app setting to determine it status.

Creating Azure function app against existing consumption plan

I have created a function app against a new consumption plan with the following command:
az functionapp create
--resource-group myresourcegroup
--storage-account mystorageaccount
--name myfunctionapp
--runtime node
--consumption-plan-location northeurope
This creates the function app correctly, but the app service plan is called NorthEuropePlan, which does not meet the naming guidelines I am following. I cannot see anything in the docs that will allow me to change this name.
Therefore, I would like to create the app service plan before, as a consumption plan (tier Y1 Dynamic), and then create a function app against this plan.
az resource create
--resource-group myresourcegroup
--name myconsumptionplan
--resource-type Microsoft.web/serverfarms
--is-full-object
--properties "{\"location\":\"northeurope\",\"sku\":{\"name\":\"Y1\",\"tier\":\"Dynamic\"}}"
That command works correctly, and creates me an app service plan. However, when I try to use that plan (substituting --consumption-plan-location northeurope for --plan myconsumptionplan), I get this error:
There was a conflict. AlwaysOn cannot be set for this site as the plan does not allow it.
Do I need to specify some more configuration when I make the app service plan?
When I run az appservice plan show against NorthEuropePlan and myconsumptionplan, the only difference in the object that comes back is the name.
When you are using --plan I believe the run time will think it is an App Service Plan and will configure Always ON which is not allowed in consumption plan so I guess you cannot do it like the way you are doing.
You can achieve it with ARM template though. Below is the example command:
az group create
--name ExampleGroup
--location "North Europe"
az group deployment create
--name ExampleDeployment
--resource-group ExampleGroup
--template-uri "https://raw.githubusercontent.com/Azure/azure-quickstart-templates/master/101-function-app-create-dynamic/azuredeploy.json"
The URL mentioned in the template-uri is sample template which will create consumption-pan, storage and functionapp.
Deployment will ask the name of parameters (appName) at runtime.

Resources