Grab bash script from an storage account and install in a Linux VMSS - azure-storage

I have a bash script in an azure storage account and I want to call that script from an Azure VMSS, when a new version of the script is available. Is this possible?
Thanks

Custom Script Extension can be used to run the script in VMSS.
The Custom Script Extension downloads and executes scripts on Azure virtual machines. This extension is useful for post deployment configuration, software installation, or any other configuration or management tasks. Scripts can be downloaded from Azure storage or GitHub, or provided to the Azure portal at extension run time. The Custom Script Extension integrates with Azure Resource Manager templates, and can be run using the Azure CLI, PowerShell, Azure portal, or the Azure Virtual Machine REST API.
It can be called on Virtual Machine Scaleset using Add-AzVmssExtension

Related

Integrate Automation testing on Linux Agent through Azure Devops pipelline

I am using Azure devops pipeline to create an customized redhat iso. We are creating KVM Virtual machine on the agent host through the same pipeline after iso creation so that we can perform the testing on the VM.
I have tried running the test through vstest but it worked only for windows agent.
Can anyone please guide me with the other options of the test framework to automate the test on the linux agents?

Hotswap DLL issue to update ASP.NET Zero dotnet core based webapp using Azure DevOps CD

We are building a webapp for our clients using ASP.NETZero template built on dotnet core 3.1.x
I am trying to create release pipeline in Azure DevOps and facing issues while publishing the changes of build pipeline to IIS similar way I did for traditional MVC5 or MVC6 .NET Framework based webapps.
The self-hosted devops agent is running on a different machine than production server where the webapp is published and the agent service account has access of the shared path of the \\server\inetpub-sharedhostingdir only.
Traditoinally, Copy Files task could replace app DLLs and all other files but in .NETCore there is an error like below:
Then I found out that this is because of changes how .NET Core 3.1.x hosting works.
I also tried to use 'OutOfProcess' in the web.config in the webapp but still getting same error and then I found this SO post and DLL hotswap info given by #MindingData.
So, my current bat to overcome this issue is using remote powershell in CD; I can stop the webapp and publish the new artifact. But there is cost for this step, I have to stop the site and replace all the DLLs which may roughly takes 30 seconds.
The remote Azure DevOps agent does not have access to do so right now and yet we have to add firewall exceptions to do so.
I am wondering if there is any other efficient alternative to publish .NETCore 3.1.x webapp using AzureDevOps agent running on a remote server? (as access of production server is restricted and we cannot deploy the azure agent on production machine.)
Because of these issues currently I need to move all the DLLs in 'backup' directory manually to make the hosting directory empty and then if I run the pipeline of first image, the 'Copy Files To' runs successfully and publishes the app well.
Any suggestions for improving the CD in current environment?
You may try using 'app_offline.htm' file for graceful shutdown of your running application and after deployment you can easily remove that file using powershell command task.
This approach should work as you have access of the deployment directory of the remote server. Steps are mentioned on the SO post.

How to deploy an existing VHD without any third party tool?

I have created some VMs using Microsoft Hypervisor. I have the vhdx files for those VMs. now i want to use these same vhdx files to deploy new VMs on let's say other machines,or on the same machine with different names. IS it possible? If it is, Is it possible to deploy VHDs via a script?
I have not personally tried but through Windows PowerShell you can do it. Refer following links for more details:
https://www.starwindsoftware.com/blog/automate-the-hyper-v-virtual-machine-deployment-with-powershell
https://technet.microsoft.com/en-us/library/jj933287.aspx
https://www.altaro.com/hyper-v/hyper-v-attach-existing-virtual-disk/

How to configure WinRM for azure virtual machine in resource manager portal

I have created a VM in azure resource manager portal using powershell. How to configure WinRM in VM for remote access using powershell. Thanks in advance.
This can be done by adding a custom script extension when deploying the VM. An example can be found here.
To add this to an existing VM, just copy the ConfigureWinRM.ps1, makecert.exe and winrmconf.cmd files from the same quickstart folder and execute the powershell script.

Importing database from an sFTP server in Windows Azure

I'm building a website that will surface data from a third party system. The third party will provide a copy of all the data I need as a SQL restore file (*.bak) inside a rar file on their sftp server. The data changes every day, so my application will need to connect to the sftp site, get the file, unzip it, then restore it into my database server every night. I'm fairly comfortable scripting this in a standard windows environment, but the customer would prefer the application to be built on the MS Azure cloud, which doesn't seem to support a common solution to the problem. It's possible we could abandon Azure, but I'd like to know what the best strategy would be for implementing in Azure if it's possible.
This depends on whether you are trying to use Azure PaaS (cloud service and SQL Azure) or IaaS (VMs). If you are using VMs on Windows Azure, there is going to be no difference between Windows Azure and your familiar Windows environment - so yes, you can do this on Windows Azure.
This can't really be done in Azure cloud services and SQL Azure (SQL Azure cannot restore a .bak file). But your application doesn't seem to be the kind that would run as a cloud service anyway.
Stick to doing it on VMs and it will work as you are familiar with.