We are creating the azure worker role deployment package via our ci server and deploy the package to the azure cloud service using Azure Powershell cmdlets script.
however the diagnostic configuration does not get apply to the deployment; it only works when we deploy manually from within visual studio.
is there a way to do that in the powershell script to take into account the diagnostic setting (performance counter..etc) ?
You can use Set-AzureServiceDiagnosticsExtension PowerShell Cmdlet to enable diagnostics. You may find this link useful for this purpose: http://azure.microsoft.com/en-in/documentation/articles/cloud-services-dotnet-diagnostics/ (Please see Step 5: Install Diagnostics on your Worker Role).
Related
I would like to turn ON/OFF HTTPS Only of my website during the pipeline execution.
Set-AzWebApp -ResourceGroupName $(ResourceGroupName) -Name $(WebAppName) -HttpsOnly $flase
I am using private windows agent.
I am getting following issue
I have Az installed on my server.
Could you please help me?
To use Azure ClI task you need to follow below prerequisites
A Microsoft Azure subscription
Azure Resource Manager service connection to your Azure account
Microsoft hosted agents have Azure CLI pre-installed. However if you are using private agents, install Azure CLI on the
computer(s) that run the build and release agent. If an agent is
already running on the machine on which the Azure CLI is installed,
restart the agent to ensure all the relevant stage variables are
updated.
According to your error log, seems Azure CLI is either not installed properly or detected by Azure DevOps.
Please make sure you have restarted the build agent to ensure all the relevant stage variables are updated.
Besides, you could also try to use Azure CLI on the private agent directly check if you are able to use above Azure command to turn off https. This will also narrow down your issue.
I have a web project and Azure cloud service deployment project. I am currently deploying to Azure cloud service manually by creating package and updating the package in Azure portal. I wanted to automate this process using PowerShell script. I found a blog which list out the steps, but it is very old. Also, I am not able to use exec msbuild command that is mentioned in this article. Can you help me how to following command? I am not able to execute this from powershell window.
exec { msbuild /p:Configuration=Release /p:DebugType=None /p:Platform=AnyCpu /p:OutputPath= /p:TargetProfile=Cloud /t:publish /verbosity:quiet }
https://www.kenneth-truyers.net/2014/02/06/deploying-cloud-services-to-azure-with-powershell/
Are you using azure devops? If yes, and automating the deployment of your website to cloud is the problem then consider using pipelines? I hope I understood your question correctly!
I have several .NET applications that are hosted In Azure on virtual machines IIS. I want to automate deployment process directly from my machine or visual studio without using Azure portal because we are doing several deliveries each day. The biggest challenge for me now is to do backup before deployment. So I need to backup specific folder on VM remotely. Could anyone tell me how I can do it?
Are there any best practices for automation delivery from visual studio to Azure VM? Backup of app is required.
First, I'm assuming that you would like to back up some specific folders in your VM to an Azure Blobs or Azure Files storage. There are two parts you'd need to complete your continuous deployment:
Automate backing up some folders in your virtual machine.
Integrate task #1 into a CICD (Continuous Integration Continuous Deployment) tool, which I'd suggest VSTS (Visual Studio Team Services) for your beginning.
Approach #1
You can expose Windows Remote Management (WinRM) endpoint publicly and use PowerShell to perform a folder backup task. You will also need to invoke some scripts to write/copy your backup to Azure Blobs Storage. Your script must be authenticated silently so you don't need to key in Azure subscription admin or VM admin.
Once you have a PowerShell script, you can invoke this PowerShell by creating a new PowerShell task in your Build or Release definition. I'd suggest to define in Release definition.
Approach #2
It's more Cloud native and you don't have to expose WMI of your virtual machine which would lead to security threat. Instead, you utilize Azure Automation Worker to automate the entirely backup & copy to another Azure services (Blobs, Files, another backup/file server virtual machine..). In your run book, you need to use PowerShell DSC (Desired State Configuration) to interact with resources inside your virtual machine.
In VSTS, you have two ways to start your runbook
Invoke runbook's webhook: you can create a webhook for your runbook and call this webhook by creating a Http Task
Start runbook by PowerShell: similar to the approach #1, just create PowerShell task then use Start-AzureAutomationRunbook cmdlet with sample here.
Build an ARM template for your Runbook then define in Build definition. Here is the sample reference to deploy an ARM template in VSTS,
The reason I have to give several references because you might not have familiarity with CICD and DevOps concept, as well as some useful tools in Azure and VSTS which supports your continuous deployment. There are some awesome CICD solutions in the market you should also explore, such as Chef, Ansible, Puppet. They support CICD very well. Below are some references to get started with DevOps on Azure:
https://learn.microsoft.com/en-us/vsts/deploy-azure/
https://learn.microsoft.com/en-us/azure/automation/automation-dsc-overview
https://learn.microsoft.com/en-us/vsts/build-release/apps/cd/azure/azure-devops-project-aspnetcore
I have created in my VS2015 an azure cloud service with a worker role. These are 2 projects.
I want to know how can I pack and then publish this cloud service with a tool/cli?
When I google for 'deploy azure cloud service' I get only result saying to do it within Visual Studio or Visual Studio Team System.
This is NOT what I want!
We can use the cspack command line tool to package a cloud service. If the application only contains worker role, you could refer to the following command.
cspack D:\xxx\xxx\ServiceDefinition.csdef /role:WorkerRole1;D:\xxx\WorkerRole1\bin;D:\xxx\WorkerRole1\bin\Debug\WorkerRole1.dll
And you could refer to the PublishCloudService.ps1 script template in this article.
cspack could not be found in the powershell commandlets
The cspack could run in Windows PowerShell on my side. I add C:\Program Files\Microsoft SDKs\Azure\.NET SDK\[sdk-version]\bin in Path system environment variables, and I could run the following command to package a cloud service.
I have a Web Role in Azure that is under development. I would like to make a package that can be published and tested in staging environment without the help of Visual Studio. Is there a way to publish if just the package is provided?
You can use cspack to actually create the package, but from your question it sounds more like you are asking can you publish an already created package. The answer is yes.
There are multiple ways to do this and I'll provide three:
1) The management portal: you can deploy a package if you have the cspkg and csconfig files. Under the Cloud Services you can select a cloud service and select to deploy to the production or staging slot. You can also do this as part of creating a new cloud service in the portal. http://www.windowsazure.com/en-us/manage/services/cloud-services/how-to-create-and-deploy-a-cloud-service/
2) You can use Windows Azure PowerShell and CLI command line tools to deploy an already packaged deployment. In fact, you can also automate packaging and deploying. http://msdn.microsoft.com/en-us/library/windowsazure/jj883943.aspx
3) Using a tool like Cerebrata's Azure Management Studio you can also deploy already created packages : http://www.cerebrata.com/products/azure-management-studio/features
In additiont to being able to deploy an already created package, for Cloud Services you can also wire up to the hosted TFS service and have it deploy your web app when you do a check in. http://www.windowsazure.com/en-us/develop/net/common-tasks/publishing-with-tfs/