Configure Windows Azure Caching (preview) Cache Client Programmatically - azure

Trying to convert from Windows Azure Shared Caching to Windows Azure Caching (Preview) where I was able to programmatically configure the DataCacheFactory via the DataCacheFactoryConfiguration class. Is the possible in the Caching (Preview)? If so, what are the values that need to be set for the server configuration?
Take a look at the old documentation ( http://technet.microsoft.com/en-us/library/gg618003.aspx ) I have not been able to find the "preview" version of this documentation.

The "How to" documentation on using Windows Azure Caching Preview is here. To include nuget package for Caching Preview please check section "Getting Started with Windows Azure Caching (Preview)" and also take a look at the section "Working with Caches" which shows code on how to use API.
As these two cache are fundamentally different because on is locally available and another one is in cloud, the libraries and API to configure Cache and Cache objects are different in between two. The key difference is that Caching Preview uses the following different reference:
using Microsoft.ApplicationServer.Caching;
and the code which is depend on above is different as documented above in provided links i.e.
DataCacheFactory cacheFactory = new DataCacheFactory();
DataCache cache = cacheFactory.GetDefaultCache();

Related

How to separate Development and Production environment on Azure API management?

I am developing an application using microservice-based architecture. I Know that on Azure API management we can register our APIs. Now the problem I am facing is that my micro-services(development and production ) are deployed on AKS(Azure Kubernetes Service) and both have different IP Addresses as provided by the AKS. How do I differentiate between the two environments so that my front end team has two separate URLs for development and production? The base URI of the API Gateway on azure is pre-configured and cannot be changed, how do I get two URLs?
My main concern is do I need to create two instances of Azure API Management Service?
Have you checked Azure API Management DevOps Resource Kit . As recommended, yes you need to create two instances for your environments and deploy using ARM templates
If you don't want to create several instances, you might also try using versions and revisions.
Revisions
You can create revisions by right-clicking an API and tap "Add revision".
The revision can be accessed via the rev=2 url specifier as shown in the picture above. After successful testing, you can easily set a revision to be the "current" API, which won't need a revision specifier anymore.
Versions
You can create a version by right-clicking an API and tap "Add version".
In the "Versioning scheme" dropdown, you can also choose how the version should be specified. The options are:
Path
Query string
Header
so you can target each version separately.

how to port app insights configuration from azure to config file

We enabled application insights via azure portal some time ago. Everything worked great and we want to log bit extra custom information. So we will have to include appInsight SDK and create TelemetryClient and RequestTelemetry in our code now.
Ideally, we would like to enable the exact same setting as we enabled in azure portal (e.g. enable profiling, recommended collection level, sql command and disable Snapshot debugger).
However, when I look at the appinsight config file, I realised that this file is way more complicated than what azure portal offers.
Is there a way to convert what we enabled on azure portal to the config file?
Or if I delete this config file (just add the custom field in our c# RequestTelemetry instance), will appInsights use settings from azure portal automatically?
If you are using Asp.Net Application, installing SDK by default will generate the full ApplicationInsights.Config file for you, which would do same level of monitoring as Recommended level.
https://learn.microsoft.com/en-us/azure/azure-monitor/app/asp-net
And follow this to get full SQL Text:
https://learn.microsoft.com/en-us/azure/azure-monitor/app/asp-net-dependencies#advanced-sql-tracking-to-get-full-sql-query
If you are using Asp.Net Core Application, installing SDK by default will automatically configure everything in code (there is no ai.config in asp.net core apps).
https://learn.microsoft.com/en-us/azure/azure-monitor/app/asp-net-core
You dont need to do anything additional to get full SQL Text in Asp.Net Core apps.
SnapShotCollector is not enabled by default, so you dont need to do anything to disable it.
Profiler: https://learn.microsoft.com/en-us/azure/azure-monitor/app/profiler#enable-profiler-manually-or-with-azure-resource-manager
For application insights, maybe you know that there is 2 ways to apply Application Insights to your .NET web applications(For details, please refer to here).
Build time: add application insights sdk
Run time: via azure portal without adding sdk to your project.
And the screenshot below shows the difference of them(you can ignore the Note section about build-time and run-time in this article, this gives users confusion and an issue is tracking that):
And for your issues, I suggest you'd better use both of them: adding sdk and also enable/disable profiler / snapshot debugger / sql command via azure portal.
I did some tracing about sql command before, without enable from azure portal, you cannot get a details sql command info from application insights with just adding sdk. Not make some changes via config file.
And there're also described in docs like below, take profiler for example:
In the profiler doc, it says: Follow these steps even if you've included the App Insights SDK in your application at build time.
And also, it would be more difficult to change appinsight config file to meet your need, there is even no official doc about these for apply profiler / sql command via config file.
I just found a blog about how to configure snapshot debugger via appinsight config file, you can take a look and try it at your side.

Azure WebSites and Distributed caching

What is the right way to implement azure websites (not webroles) that use distributed caching?
Does Azure have anything built in or a 3-rd party has to be involved?
Edit:
I have been struggling with suggested Windows Azure Caching. The server kept responding with error ErrorCode<ERRCA0019>:SubStatus<ES0001>:Check the client version. It should be within the allowed version range on the server. If necessary, upgrade the client to the allowed version.
After looooong search I have stumbled upon this link that fixed it all.
Bottom line, when looking for NuGet package, DO NOT use Windows Azure Caching, but Windows Azure Shared Caching v1.7.
Windows Azure Cache Service (Preview) has just been released. That is the best way to use distributed caching with Azure Websites.
The Shared Caching service is being deprecated!
Well the easiest way is to just use Azure Shared Caching for distributed caching. You will have to provision the caching in the Azure Management Portal but then after that the API is pretty straightforward.
Here is a link to the Nuget package for the libraries: Windows Azure Caching
The prices for distributed caching are pretty outrageous still: Azure Cache Pricing

Scaling Orchard with Azure Web Sites

I am currently experimenting with installing Orchard on Azure using the recently released "Web Sites" functionality.
I have successfully installed and setup Orchard using the template from the gallery and so far everything seems to be going well.
My question is: If I scale up the site to use 3 instances is there anything special I need to do to ensure that the instances all work from the same cache? So a new page appears on all instances at once.
I have a little experience with Umbraco and I had to push documents and the cache into blob storage for it to work correctly.
Is this already taken care of by the template?
Thanks for your help,
Dan
There is a guide on the Orchard website that explains how to deploy to a Windows Azure Web Role (Cloud Service). I haven't seen an implementation for Windows Azure Web Sites that supports more than one reserved instance.
In order to make Orchard work on multiple reserved instances you'll need to configure it to use the AzureBlobStorageProvider, which will make sure files are persisted to blob storage instead of local filesystem. This is how you would configure the Sites.config:
<component instance-scope="per-lifetime-scope"
type="Orchard.Azure.FileSystems.Media.AzureBlobStorageProvider, Orchard.Azure"
service="Orchard.FileSystems.Media.IStorageProvider">
</component>
In your Global.asax.cs you'll also want to make sure the storage account information is read from the web.config:
CloudStorageAccount.SetConfigurationSettingPublisher(
(configName, configSetter) =>
configSetter(ConfigurationManager.AppSettings[configName])
);

Configuring New Distributed Cache for Azure Websites Preview

UPDATE: Nevermind I've found it. It's not done via the Azure Portal but inside the Azure Project Properties Dialog inside Visual Studio.
Anyone know where the new Distributed Cache Feature (I'm not talking about Azure AppFabric Cache) that Scott mentioned in his post can be configured for a website?
Adding information for those who may be wondering what is it:
Yes "Distributed Cache" is a instance specific feature which can be configured during development time with Windows Azure June SDK, via Role properties in Visual Studio as seen in this screen shot:
This feature is available only for Windows Azure Virtual Machine and roles but not for "Windows Azure websites (FREE) in Shared Mode".
The distribute cache is not available in the Azure Website Free or shared because you are not alone on your instance. It should become possible on a reserved, but still not available. Don't forget that the distribute cache is still in preview, so always evolving.

Resources