Deploying Gatsby App to Azure with secrets - azure-devops

In the instructions to deploy a Gatsby app to it relies on a Github repository to deploy. But my repository specifically ignores (ala .gitiignore) files that contain secret keys. What is the best way to deploy a Gatsby app to Azure with secrets?

The best way would be using Secure files in azure devops.
Go to Azure project portal --> Pipelines-->Library-->Secure files Tab-->click + Secure file to upload the files which contain secret keys to azure devops server.
Then you can consume the secure files in a Pipeline by using Download Secure File task.
After the secure file is downloaded in the pipeline, its path can be referenced in the pipeline as $(mySecureFile.secureFilePath) (mySecureFile is the name given to the task). Alternatively, downloaded secure files can be found in the directory given by $(Agent.TempDirectory)
You can also use Copy files task to move the secure file around in the agent machine.

Related

How to generate deployment files Azure DevOps - TFVC

I have hosted ASP.NET Core and .NET Windows application to DevOps Services - TFVC (Cloud)
Now, I am stuck with how to generate deployment files, like debug folder of .NET Windows app or cloud hosting files of ASP.NET Core.
I have created a pipeline to generate deployment files, but how can I execute from the local machine so that developer can get the necessary files to host or install?
Thanks.
Since you have created a pipeline to generate deployment files, you could add a archive task and a Publish build artifacts task to publish the target files.
Archive files: https://learn.microsoft.com/en-us/azure/devops/pipelines/tasks/utility/archive-files?view=azure-devops
Publish build artifacts: https://learn.microsoft.com/en-us/azure/devops/pipelines/tasks/utility/publish-build-artifacts?view=azure-devops
So the developers could download the .zip files from the pipeline summary page to host and use.

Azure DevOps deploy Angular app to IIS with Octopus

I'm trying to deploy a Angular application to my IIS server using Octopus and Azure DevOps
My application has multiple environments, each environment with it's own settings (config.prod.json)
What I want to do
Basically Octopus should take the release from Azure DevOps, and copy the release to multiple folders, with different config.prod.json files.
Each folder corresponds to a specific IIS website.
Azure DevOps pipeline setup
Use Node 14.x
npm install
ng build --prod
Archive dis/angular-app ; Archive type: zip
Publish Artifact; Path $(Build.ArtifactStagingDirectory)
Triggers : Enable continuous integration
Azure DevOps Releases setup
1. Package Application for Octopus
2. Push Package(s) to Octopus
3. Create Octopus Release
Octopus setup
One step DEPLOY TO IIS
1. Package details
2. Custom Installation Directory
[![enter image description here][5]][5]
3. IIS Web Site and Application Pool
Errors
In IIS while I click Binding, Basic settings, I get this error: There was an error while performing this operation. The parameter is incorrect
Also, the folder mapped in iis for the website that I'm targeting. Contains a folder drop with the zip file 27.zip (27 is the release id)
How do I unzip the zip file?
How do I replicate the zip file to the other environments?
Is my configuration ok so far? What am I doing wrong?
Just a few of the links that I've checked:
https://octopus.com/docs/guides/deploy-aspnetcore-app/to-iis/using-octopus-onprem-azure-devops-builtin
https://www.youtube.com/watch?v=NFqrWsUPCAM&t=345s
https://www.youtube.com/watch?v=oeNYtYuhZQ4&t=2s

Copy or Rename file in sub folder under Web App through azure release pipeline after web deploy

I have an Azure DevOps release pipeline, deploying my code using Web Deploy to Azure Web app to different environments (Dev/ SIT/ UAT/ PROD). Now, I need to include a task to copy/ rename one Configuration file (environment specific), which is inside 'Config' folder, to another file inside the same folder. Please note, the config file is not under the root folder of the web app.
Is there a way to accomplish this using 'post deployment action' or command line script task? I couldn't understand how can I refer the source folder of the web app for the copy operation. I was referring the following page but couldn't find one that will help me to achieve the task. Any help is appreciated.
https://learn.microsoft.com/en-us/azure/devops/pipelines/release/variables?view=azure-devops&tabs=batch
The Post deploy action script is running on azure (through Kudu API): Command
So, if the file is existing on the azure web app, you could copy it through Post deploy action script, for example, Site.css is in wwwroot\Content folder after deploying, then the script could be like this:
Copy Content\site.css Content\site1.css /a
Otherwise, you could store the necessary data in App settings or Configurations of Azure Web app.

How do I deploy azure funtion app packaged as .nugpk using azure devops?

I have a build pipeline that generates .nupkg for azure function, when I try to release it the content gets deployed (I can see when I download the app content) but I cannot see the function.
Is it the case that azure artifact has to be .zip for azure function? I am able to deploy the angular and .net core app using .nupkg without any problem!
Is it the case that azure artifact has to be .zip for azure function?
You re right.
Currently, only .zip package files are supported.
That because:
Zip deployment is a feature of Azure App Service that lets you deploy
your function app project to the wwwroot directory. The project is
packaged as a .zip deployment file. The same APIs can be used to
deploy your package to the d:\home\data\SitePackages folder. With
the WEBSITE_RUN_FROM_PACKAGE app setting value of 1, the zip
deployment APIs copy your package to the d:\home\data\SitePackages
folder instead of extracting the files to d:\home\site\wwwroot.
You could check the document Run your Azure Functions from a package file for some details.
And there is state about that:
Hope this helps.

Publishing artifacts to an external server

We are using azure devops pipeline to build our application including a Azure build agent. At the end of this process, I would like to publish the artifacts to an on-premise server shared directory (which will connect to company mandated deployment process (repliweb)).
Is that possible?
Looking at the documentation it looks like I can use publish artifact or copy file step (or maybe even ftp).
Our IT organization needs to know the IP/port so that the firewall rules can be authored.
Where can I get that information?
I suppose the other possibility would be have our server pull the artifact from Azure devops.
Publishing artifacts to an external server
For this issue, you can try to use FTP Upload task in the pipeline. Using this task in a build or release pipeline to upload files to a remote machine using the File Transfer Protocol (FTP), or securely with FTPS.
For details,please refer to this document.