update ServiceConfiguration.cscfg file without need of developer - azure

I am new to windows azure. So i am doing RnD. Can we update ServiceConfiguration.cscfg directly or we have to deploy the role through visual studio.
I am getting below error while updating ServiceConfiguration.cscfg. or we can't update it for staging environment?
"The configuration could not be uploaded for the staging deployment of cloud service ."

Not 100% sure what you're trying to do but there are two scenarios where you would be updating the config file:
You are changing value of an existing item in config file: If all you want to do is change the value of an existing item in the config file, you can do it through Azure Portal as well. There's no need to redeploy the application.
You have added/removed an item in config file: If you have added a new entry in the config file or removed an existing entry from the config file, then you have to redeploy your role.

Related

How to configure appsettings on a auto-generated preview environment

How can I change the appsettings on the preview environemnts that are generated by the Azure Static Web Apps CI/CD Github Action for each pull request?
I can go to the portal, navigate to the generated environment and change its appsettings. Doing this manually for each new pull request is error prone and will become tedious really fast.
I couldn't find any reference to this in the Build Configuration For Azure Static Webapps docs so I'm assuming it can't be configured that way.
I also couldn't find any reference to SWA environments in the CLI docs.
I looked into deployment environments but it looks like this is some other kind of deployment environment as it keeps mentioning devcenter.
In Azure Portal, While Creating Static Web App, after providing the GitHub Repo and Branch details, we will get an option to preview the Workflow file.
I can go to the portal, navigate to the generated environment and change its appsettings
Yes, In Configuration Section we have an option to add the App settings. But it is a manual work, which is not advised to follow.
Once we click on Review + create and create the Static Web App, a new folder with name .github/workflows will be created in the GitHub Repository.
It contains the same workflow file (preview file), which we saw while creating the Static WebApp in Azure Portal.
We can edit the Workflow manually.
To update the appsettings/configurations in the workflow, we can specify the steps in the existing workflow file.
We can use either Powershell/Azure CLI commands to update the Appsettings.
az staticwebapp appsettings set --name YourStaticWebAppname --setting-names "message=HelloEveryOne"
***Sample code for Updating App settings: ***
Before Build and deploystep in Workflow, add the below steps.
- name: Build And Deploy
- run : Your Update appsettings Script
To edit the Workflow file, click on the .github/workflow => .yml file
References taken from MSDoc 1 and 2.
Update
As per the discussion in GitHub, adding appsettings to the preview environment is not currently supported in the default Azure Static Web Apps CI/CD.
Setting appsettings on a specific environment is not currently supported in the Azure Static Web apps CI/CD nor by the Azure CLI.
There is a discussion in GitHub about it.

New Relic installation via Deployment slots in an Azure DevOps pipeline

We have the below settings that needs to be done for an app service to install new relic extension:
Ensure the "New Relic Agent" Extensions exist within the App Services Deployment Slot.
The files will be installed in NEW_RELIC_HOME : "C:\home\newrelicAgent". Following the deployment the newly created newrelic.config will need to be replaced with the applicable config for the Application Service.
From the files uploaded, rename {serviceAppName}_newrelic.config to simply "newrelic.config " and replace
"*The newrelic files will load with the worker process and starts profiling post restart of the appservice i.e. with the newly initiated worker process.
ost installation of newrelic extension, we need to replace the newrelic.config file in the below directory.
for dotnet framework applications:
C:\home\NewRelicAgent\Framework>
for dotnetcore applications:
C:\home\NewRelicAgent\Core>*
Unique to each file is the 'Appservicename', also containing the license key information:
NEW_RELIC_LICENSE_KEY : "License key"
NEW_RELIC_APP_NAME: "Appservicename"
Could you please help in updating the pipeline with the settings in an Azure DevOps.
Thanks,
Swabha

Azure DevOps - Azure App Service deploy - Adds Application settings WEBSITE_RUN_FROM_PACKAGE causes CSS to not load

In Azure DevOps we have the following Azure App Service deploy task in our release pipeline:
This works good but it adds Application settings WEBSITE_RUN_FROM_PACKAGE = 1 for Azure App Service
The web application starts but for some reason /lib/ionic/release/css/ionic.min.css is not loaded with this setting.
If I remove WEBSITE_RUN_FROM_PACKAGE and upload the exact same files via FTP everything works as expected.
I know WEBSITE_RUN_FROM_PACKAGE comes from the .zip file deployment but is there anyway to modify the task to simply upload a folder or do I need to use the FTP upload task then? I know WEBSITE_RUN_FROM_PACKAGE makes wwwroot read-only but what could be causing this? With this setting a GET to the resource simple gives the following error:
The resource you are looking for has been removed, had its name
changed, or is temporarily unavailable.
https://learn.microsoft.com/en-us/azure/azure-functions/run-functions-from-deployment-package
Solved the upload with FTP Upload task
https://learn.microsoft.com/en-us/azure/devops/pipelines/tasks/utility/ftp-upload?view=azure-devops
However after doing this I still had the same error.
Went into App Service Console and there I could not see the file at all.
I finally solved it by looking at the file name, /lib/ionic/release/css/ionic.min.css. In our .gitignore file we exclude [Rr]elease/. Adding a ignore with !AppFolder/** solved it so the files were added to git.

Azure Functions App is Read Only after publishing

I have several Azure Functions Apps (c#, javascript and python) and after some time they were all randomly set to Read Only mode. The strange thing is that only one of these 3 function apps were updated before this happened. I know that this is not necessarily a problem, but I want to be able to make edits from the portal.
I can't open App Service Editor
I can't set the app to Read/Write from Function App Settings -> Function app edit mode
I also tried using "func azure functionapp publish myAzFuncAppName --nozip", but with the same result
Of course. Please notice that if the function is 'deployed' to Azure, what will be deployed is the compiled file.
For example, if you deploy C# function app, what will be deployed is the dll file. So this is why it is readonly.
Changes to the code should be done before compiling them into corresponding 'cannot be edited' files, which requires special attention.
But for the modification of the declarative part and the configuration part of the function, this is possible, the specific steps are as follows:
Declarative part:
Then click Debug Console > cmd:
Go to site\wwwroot[yourfunctionname], and there will be a function.json.
Click the 'pen' to edit and don't forget to save.
Configuration part:
You can change the settings from Azure Portal or by editing the application settings. FUNCTION_APP_EDIT_MODE allows values readwrite and readonly, a
Just deleted the Azure Function App, created a new one, transferred the code in the new one and deployed -> still read only, but now I was able to open "App Service Editor" and remove "generated by..." from function.json and then set "Read/Write" from Function App Settings -> Function app edit mode.
Still... I can't see/edit the code of the function, only of function.json and if I redeploy using Azure extensions of Visual Code or powershell with --nozip attribute, the "generated bla bla" appears again :(
When the application runs from package, the files are loaded from that package. Hence those files are not editable.
You need to set WEBSITE_RUN_FROM_PACKAGE : 0 in app settings and redeploy the application again to make the function app editable.
refer https://social.msdn.microsoft.com/Forums/en-US/972d843c-8bdc-4cfc-9c6d-263df196d37c/azure-function-app-readonly-mode?forum=AzureFunctions
UPDATED:
You can deploy functionapp through command line from visual studio code. Try below command.
func azure functionapp publish --nozip
The nozip flag would set Run-From-Package mode off .
you can access other information regarding that command with func azure functionapp publish --help

Find Azure slot location in azure App Service Deploy

How to find Destination path of deployed web site on Azure App Service Deploy - Azure Slot ?
I need to delete existing old files on a destination specific folder which are generated uniquely on each release(during build process).
This has to be done during pre-deployment.
I used Delete Files Task which is not deleting. Here is YAML.
In Kudu , I am able to see my web site location is D:\home\site\wwwroot\
I wanted to delete files from the path D:\home\site\wwwroot\scripts\libs>
steps:
task: DeleteFiles#1
displayName: 'Delete files from $(build.artifactstagingdirectory)'
inputs:
SourceFolder: '$(build.artifactstagingdirectory)'
Contents: 'scripts\libs**'
You don't have to manually delete old files on your App Service Instance or its Deployment Slots. When you are using Azure App Service Deploy task you have the option built-in to remove any unused files at the destination (in this case App Service Instance/Deployment slot). Here is how to do it.
On the Azure App Service Deploy task,
Expand Additional Deployment Options.
There make sure Select Deployment Method checkbox is selected
From the Deployment Method drop down, Select Web Deploy
Select the Remove additional files at destination checkbox
If you want to keep any file that is installed with App Service Extensions or WebJobs select Exclude files from the App_Data folder as well
What this will do is it will compare the files that are already at the destination (App Service) with the files that will be copied over from the Artifacts. Then it will delete any file that is not available in the artifacts that you are doing to deploy.
Find Azure slot location in azure App Service Deploy
You may not delete the correct folder.
According to the first image in your question, we could to know you are deleting the file from the folder $(build.artifactstagingdirectory).
As we know, the folder $(build.artifactstagingdirectory) is the local path on the agent where any artifacts are copied to before being pushed to their destination.
Check Build variables for some more details.
However, I do not find any task in your build definition to copy file to the artifacts.
Besides, you said you delete existing old files on a destination specific folder which are generated uniquely on during build process.
So, I am bold to guess that the file you want to delete should be in System.DefaultWorkingDirectory instead of artifacts. But I am not very sure about it, since I could not distinguish folder type from the path D:\home\site\wwwroot\scripts\libs>.
So, to resolve this issue, you can try to delete the file from $(System.DefaultWorkingDirectory).
Or you can use a Inline Powershell task to outcome the value of $(build.artifactstagingdirectory):
Write-Output '$(Build.ArtifactStagingDirectory)'
Then check if the value is match the path of folder you want to delete D:\home\site\wwwroot\scripts\libs>.
Hope this helps.

Resources