How can I test changing Azure service configuration settings at runtime locally? - azure

I am writing our Azure app to use Azure service configuration settings so we can change it in real time. I can test it by deploying and then changing them in the Azure web portal.
How do I allow changing service configuration in real time on my local azure compute emulator?

In order to update the service configuration you need to modify the *.cscfg file and execute csrun.exe (in C:\Program Files\Microsoft SDKs\Windows Azure\Emulator):
csrun.exe /update:<deployment-id>;<service-configuration-file>
Note that this seems to work only when running the application without debugger.
I recently blogged about this here: Controlling your instances in the Windows Azure Compute Emulator (look under Handling the RoleEnvironment.Changing event in the emulator).

Related

stdout log files are empty in azure web service

I have created an azure web service app used for testing purposes and run into a .Net / http issue (500.30). Ive looked into a lot of troubleshooting but nothing has worked or pointed me in the right direction.
It seems to get more info on the issue, I can use the stdout logs in the Azure app service through Kudu. This has been configured this and the files it creates are blank? Has anyone encountered this before?
What have I did, I set it up in the web.config file setting the stdlog to true but this creates the files with no info. I then removed the inprocess=hosting section as I read this fixed it for others but no joy.
Any pointers in the right direction would be appreciated
HTTP Error 500.30, The log file is created but empty - This kind of scenario is trapped by the SDK when publishing a self-contained app.
There is a term called RID (Runtime Identifier) used to identify target platforms where a .NET Core application runs.
If the RID doesn't match the platform target then the SDK produces the above kind of errors.
For example, win10-x64 RID with <PlatformTarget>x86</PlatformTarget> in the project file.
Troubleshooting steps:
<PlatformTarget>x86</PlatformTarget> enables the IIS app pool for 32-bit apps in an x86 framework-dependent deployment and set Enable 32-bit Apps to True from the app pool's Advanced Settings of IIS Manager.
500.30 is In-Process Startup Failure as it's cause can be usually determined from entries in the Application Event Log and the ASP .NET Core Module stdout log.
The app is misconfigured due to targeting a version of the ASP .NET Core shared framework that isn't present. Check which versions of the ASP .NET Core Shared framework are installed on the target machine.
If you're using Azure Key Vault, check the policies in the targeted Key Vault to ensure that the correct permissions are granted.
Also, please visit this Thread related to logging not working fix.
And Application Insights should be enabled to get the log files in the Storage account.
You can stream the logs from the portal or using CLI:
az webapp log tail --name appname --resource-group myResourceGroup
Use this reference to get the logs using the simple queries.
You need to enable application logging first.
Click on the App Service logs menu
In Application logging, select File System
In Quota (MB), specify the disk quota for the application logs. In Retention Period (Days), set the number of days the logs should be retained.
Save
You can stream the logs from the portal or by using the CLI
az webapp log tail --name appname --resource-group myResourceGroup

How to check what is causing CPU bottleneck on Azure

I can't find what is causing CPU increase to 100% daily at some periodical time. Is there any way like if you have VM, task manager in Azure dashboard?
I have telemetries:
You can remote debug your Azure app with Visual Studio :
When you enable remote debugging on an Azure virtual machine, Azure installs the remote debugging extension on the virtual machine. Then, you can attach to processes on the virtual machine and debug as you normally would.
https://azure.microsoft.com/en-us/documentation/articles/vs-azure-tools-debug-cloud-services-virtual-machines/#debugging-azure-virtual-machines
Also to try to understand what happened in the past: if you have activated Azure Diagnostics, you get the output logs in a Azure Storage that you configured for diagnostics. You can have a look at there to try to find what caused the problem.
You can integrate app logs to azure logs to get more accurate or specific info.
https://azure.microsoft.com/en-us/documentation/articles/virtual-machines-dotnet-diagnostics/
You can also use 3rd party logs like log4net, ... (see appropriate extension or nuget packages).

How do I change the size of an Azure Cloud Service Worker Role?

We have a number of worker roles in Azure under a Cloud Service that are set to size Small by default. This doesn't seem to be configurable either in the Azure Portal or the Preview Portal, so how do I go about changing the size of the worker role without using PowerShell?
This can be done in Visual Studio by right clicking on the role in question under the sub folder of "Roles", choosing properties and then there should be a drop down for VM size. Re-publish and the size change should be reflected.
Cloud Services have the VM size located in the ServiceDefinition.csdef, which is part of the deployment package. This is why you are not finding the setting in the portal. You need to build and publish a new deployment package.
Since you don't want to do this with PowerShell, you'd need to make edits directly to your csdef file via an editor / IDE and then redeploy the package.

How to view errors being generated by Azure Compute Emulator

I have a WCF service solution which contains the WCF service and a Azure Cloud Service project.
When running the cloud service project in the Azure Compute Emulator (version 2.5 on my PC), all I see in the output for each role is
[fabric] Role state Busy
[fabric] Role state Aborted
I've tweaked the logging level in Compute Emulator to log Warning, or Error and even tried Critical, but no more detailed messages are displayed. I have been Googling to see if there are any event log entries, or log files on disk, that I can view to find out why the cloud service is not working, but to no avail.
What can I do to find out more about what is causing the Cloud Service role to abort and and retry?
Diagnostics logs are not collected in the Azure compute emulator – For projects that target the Azure SDK version 2.5, the Azure compute emulator no longer supports the collection of diagnostics logs, including performance counters, infrastructure logs, IIS logs, and event logs. In addition, logs are no longer stored in Azure storage or development storage. You can continue to view application logs in the Visual Studio Output window or the compute emulator. This only affects projects that target Azure SDK version 2.5; projects that continue to target Azure SDK 2.4 are not affected.
Source: http://msdn.microsoft.com/en-us/library/azure/dn873976.aspx
In my case, it turned out to be a startup task defined in ServiceDefinition.csdef that was the problem. After I removed the <Task> my service ran fine in Compute Emulator.

In Visual Studio, can I deploy C# to my own Azure Virtual Machines rather than Azure Worker Roles?

In many of the Visual Studio demos, you can deploy a background worker role program (like a Console app or something) to Azure. Do you know if it's possible to direct those worker role deployments to an Azure Virtual Machine I'm running instead?
Many thanks
You can not use the same deploy method you have seen with Web/Worker role however you sure can deploy your application from Visual Studio to Azure VM however the medium you will choose has to configured by you. Because Windows Azure VM are mostly configured and maintained by users that's why there is no pre-built mechanism for any one to deploy application from a development machine it is all have to be configured and choose.
In your case, if you want to deploy directly from VS, you can configure web-deploy option in Azure VM (exactly same way you would to any remove VM) so you can deploy direclty. Or you can actually configure Powershell to deploy directly from Commandline as well just you would need to configure Powershell remote setting in Azure VM.
Bottom line is you would have to choose and configure your own way to deploy application from your on-premise machine and mainly because you have more ownership to the Azure VM as in any other IaaS cloud.
No. You will not be able to deploy your applications in an Azure Virtual Machine through Visual Studio. The applications which you will be able to deploy through VS are the PaaS applications (Web/Worker roles).

Resources