Thursday, December 16, 2021
LB Cash In Mobile (CIM) awarded the Silver for Best Business Model Innovation at FITIS digital excellence awards
Wednesday, December 8, 2021
Azure Policy : How I managed to comply ISO 27001:2013 for my cloud workloads
We can have many resources in our cloud. How can we enforce compliance and governance out there?
Let's say that we are already compliant with ISO 27001:2013 for our on-premises workloads. How can we achieve it after the cloud migration?
Or how can we stay compliant if we have a hybrid setup?
If your cloud provider is Microsoft Azure, then you are lucky. You can use the features of Azure Policy to save you.
Azure Policy is a service provided by Microsoft Azure, where you can assign individual policies or initiative (collection of policies) to a targeted scope (e.g. Subscription) to ensure they are governed according to those policies.
Let's try out by creating an initiative. Luckily we have ISO27001:2013 as a built-in initiative
Let's see the result.
In order to check the level of compliance, navigate to the initiative and click on View compliance link.
This was my initial score. Lot to improve, isn't it :)
As you can see below, we can see a summary of compliance split into following areas
- Controls
- Policies
- Non-compliant resources
- Events
Let's see a sample control.
Let's take the Password management system control
Now we know the current position. It's time to do some housekeeping to make our tenant compliant
Tuesday, December 7, 2021
Azure Durable Functions with retry options and retry operations
This is the third post of a serious of articles on Azure Functions/Durable functions. This is the continuation of my previous post on Durable Functions.
- Posting data to Azure Function using HTTP trigger with .NET 6
- Azure Durable Functions to implement function chaining with custom data
- Azure Durable Functions with retry options and retry operations
In this post we will discuss how we handle failures, specifically retry operations with Durable Functions.
Ability to handle failures is a key benefit that Durable Functions offer us. It is implemented using features of Durable Task Framework.
In order to illustrate retry operations we use the same example we used in previous article. Let's say saving contact details in CRM system is a heavy process and it is not under our control. Let's say it is a SaaS platform provided by a vendor. It can fail due to various reasons like
- Network related failures
- Planned/unplanned downtimes of the SaaS platform
- etc..
var retryOptions = new RetryOptions(System.TimeSpan.FromSeconds(5), 3)
{
Handle = ex => ex.Message.Contains("Network Error")
};
[FunctionName("DurableCustomer")]
public static async Task RunOrchestrator(
[OrchestrationTrigger] IDurableOrchestrationContext context)
{
Customer customer = context.GetInput();
int customerId = await context.CallActivityAsync("DurableCustomer_AddToSQL", customer);
var retryOptions = new RetryOptions(System.TimeSpan.FromSeconds(5), 3)
{
Handle = ex => ex.Message.Contains("Network Error")
};
int returnId = await context.CallActivityWithRetryAsync("DurableCustomer_AddCRM",retryOptions,customerId);
return returnId;
}
[FunctionName("DurableCustomer_AddCRM")]
public static int AddToCRM([ActivityTrigger] int customerId, ILogger log)
{
//insert to CRM
int returnId = customerId * 10; //return code from CRM insert
throw new System.Exception("Network Error");
//return returnId;
}
Thursday, December 2, 2021
Azure Durable Functions to implement function chaining with custom data
This is the second post of a serious of articles on Azure Functions/Durable functions. This is a continuation on my previous post on Azure Functions.
- Insert customer name to Azure SQL instance
- Generate auto increment id in Azure SQL
- Insert customer contact in external CRM with auto increment customer id
- First of all it is violating the Single Responsibility concept.
- We should not start CRM insertion part until the SQL insertion is completed. So some sort of statefulness is required.
- How can we ensure the durability and consistency. Let's say External CRM fails, what can we do for the entire transaction.
- Client Function (trigger)
- Orchestrator Function
- Activity Function
[FunctionName("DurableCustomer_AddToSQL")]
[FunctionName("DurableCustomer_AddToSQL")]
public static int AddToSQL([ActivityTrigger] Customer customer, ILogger log)
{
//insert to SQL logic
int customerId = customer.id; //should be populated with the reusult
return customerId;
}
[FunctionName("DurableCustomer_AddCRM")]
public static int AddToCRM([ActivityTrigger] int customerId, ILogger log)
{
//insert to CRM
int returnId = customerId * 10; //return code from CRM insert
return returnId;
}
[FunctionName("DurableCustomer")]
public static async Task RunOrchestrator(
[OrchestrationTrigger] IDurableOrchestrationContext context)
{
Customer customer = context.GetInput();
int customerId = await context.CallActivityAsync("DurableCustomer_AddToSQL", customer);
int returnId = await context.CallActivityAsync("DurableCustomer_AddCRM", customerId);
return returnId;
}
public static async Task HttpStart(
[HttpTrigger(AuthorizationLevel.Anonymous, "post")] HttpRequestMessage req,
[DurableClient] IDurableOrchestrationClient starter,
ILogger log)
{
// Function input comes from the request content.
var customer = await req.Content.ReadAsAsync();
string instanceId = await starter.StartNewAsync("DurableCustomer", customer);
log.LogInformation($"Started orchestration with ID = '{instanceId}'.");
return starter.CreateCheckStatusResponse(req, instanceId);
}
Step 8: Get the StatusQueryGetUri to check the status