Search This Blog

Monday, 31 July 2017

DSC Environment Resource

The Environment resource in Windows PowerShell Desired State Configuration (DSC) provides a mechanism to manage system environment variables.This sample has tested on PSVersion 4.0.

Step 1. Script Environment Variable Example

Here is an elegantly simple use of the Script resource. We could make it more complex in many ways, but I prefer to start out with a simple use case first. The code is its own documentation. Study it carefully.

configuration EnvDemo{
    param()
    #import the module of DSC for using DSCResources.
    Import-DscResource -ModuleName PSDesiredStateConfiguration;
    
    Environment EnvironmentExample
    {
        Ensure = "Present"  # You can also set Ensure to "Absent"
        Name = "TestEnvironmentVariable"
        Value = "TestValue"
    }
 }

#Set mof file path in other word where to generate mof file.
EnvDemo -Outputpath D:\Harshal;
#Run mof file in other word apply mof configuration to server.
Start-DscConfiguration -Wait -Verbose -Force -path D:\Harshal;

Notice the Write-Verbose statements. These are important for logging and output when the resource runs.

Step 2. Output



Step 3. Verify

[Environment]::GetEnvironmentVariable("TestEnvironmentVariable",[System.EnvironmentVariableTarget]::Machine)


Reference

  • Documentation:https://msdn.microsoft.com/en-us/powershell/dsc/environmentresource

Your Turn

Now it is your turn. Take this sample and implement your own script resources. Leave a comment below telling what you accomplished.

Best wishes on your adventure learning DSC!

PowerShell Get-DscResource

Script

Get-DscResource

Result



PowerShell ConvertTo-HTML

Script

Get-Service | ConvertTo-HTML -Property Name, Status > C:\services.htm

Sunday, 30 July 2017

Cloud Vendor

Vendor Products
Amazon Web Services Amazon Web Services
CenturyLink CenturyLink Cloud (IaaS), AppFog (PaaS)
Google Google Cloud Platform
IBM IBM Bluemix, IBM SoftLayer
Microsoft Microsoft Azure
Oracle Oracle Cloud
Salesforce Salesforce App Cloud
SAP SAP Hana Cloud Platform

Saturday, 29 July 2017

Cloud Design Patterns: Circuit Breaker

  • Handle faults that may take a variable amount of time to rectify when connecting to a remote service or resource.
  • This pattern can improve the stability and resiliency of an application.

When to use

  • To prevent an application from trying to invoke a remote service or access a shared resource if this operation is highly likely to fail.

Integration GLOSSARY

  • API A software interface that allows users to configure and interact with other programs, usually by calling from a list of functions.

  • DENIAL OF SERVICE (DOS)ATTACK An attack on a resource, caused when a perpetrator intends to make a resource unavailable by placing massive amounts of requests on the given resource.

  • DOCUMENTATION-DRIVEN DEVELOPMENT A philosophy of software development in which documentation for a feature is written before the feature is created.

  • ENTERPRISE INTEGRATION (EI) A field that focuses on interoperable communication between systems and services in an enterprise architecture; it includes topics such as electronic data interchange, integration patterns, web services, governance, and distributed computing.

  • ENTERPRISE INTEGRATION PATTERNS (EIP) A growing series of reusable architectural designs for software integration. Frameworks such as Apache Camel and Spring Integration are designed around these patterns, which are largely outlined on EnterpriseIntegrationPatterns.com.

  • ENTERPRISE SERVICE BUS (ESB) A utility that combines a messaging system with middleware to provide comprehensive communication services for software applications.

  • FARMING The idea of providing services by leveraging the services of another resource or resources.

  • GRAPHQL A query language and runtime for completing API queries with existing data.

  • HYPERTEXT TRANSFER PROTOCOL (HTTP) A protocol used to exchange hypertext. The foundation of communication for websites and web-based applications.

  • INTEGRATION FRAMEWORK A lightweight utility that provides libraries and standardized methods to coordinate messaging among different software.

  • IPAAS A set of cloud-based software tools that govern the interactions between cloud and on-premises applications, processes, services, and data.

  • MESSAGE BROKER Middleware that translates a message sent by one piece of software to be read by another piece of software.

  • MICROSERVICES Small, lightweight services that each perform a single function according to a domain’s bounded contexts. The services are independently deployable and loosely coupled.

  • MIDDLEWARE A software layer between the application and operating system that provides uniform, highlevel interfaces to manage services between distributed systems; this includes integration middleware, which refers to middleware used specifically for integration.

  • REPRESENTATION STATE TRANSFER A set of principles describing distributed, stateless architectures that use web protocols and client/ server interactions built around the transfer of resources.

  • RESTFUL API An API that is said to meet the principles of REST.

  • SERVICE DISCOVERY The act of finding the network location of a service instance for further use.

  • SERVERLESS COMPUTING A cloud computing model in which a provider manages the allocation of servers and resources

  • SERVICE ORIENTED ARCHITECTURE (SOA) An application architecture built around the use of services that perform small functions.

  • SIMPLE OBJECT ACCESS PROTOCOL (SOAP) A protocol that is used by web services to communicate with each other, commonly used with HTTP.

  • STATELESS SESSION STATE A session which no information is maintained between the sender and receiver.

  • SWAGGER A definition format used to describe and document RESTful APIs, to create a RESTful interface to develop and consume APIs.

  • WEB SERVICE A function that can be accessed over the web in a standardized way using APIs that are accessed via HTTP and executed on a remote system.

Friday, 28 July 2017

Cloud Design Patterns: Cache-Aside

  • Load data on demand into a cache from a data store.
  • This pattern can improve performance and also helps to maintain consistency between data held in the cache and the data in the underlying data store.

When to use

  • A cache doesn't provide native read-through and write-through operations.
  • Resource demand is unpredictable. This pattern enables applications to load data on demand. It makes no assumptions about which data an application will require in advance.

Reference

  • Documentation: https://docs.microsoft.com/en-us/azure/architecture/patterns/cache-aside

Windows PowerShell 5

  • Windows PowerShell is a Windows command-line shell designed especially for system administrators.
  • Windows PowerShell includes an interactive prompt and a scripting environment that can be used independently or in combination.
  • Windows PowerShell is built on top of the .NET Framework common language runtime (CLR) and accepts and returns .NET Framework objects.
  • Windows PowerShell introduces the concept of a cmdlet (pronounced "command-let"), a simple, single-function command-line tool built into the shell.
  • t is a replacement for the venerable CMD (command) shell.

PowerShell

Starts a Windows PowerShell session. You can use PowerShell.exe to start a Windows PowerShell session from the command line of another tool, such as Cmd.exe, or use it at the Windows PowerShell command line to start a new session. Use the parameters to customize the session.


PowerShell ISE

You can use the Windows PowerShell® Integrated Scripting Environment (ISE) to create, run, and debug commands and scripts. The Windows PowerShell ISE consists of the menu bar, Windows PowerShell tabs, the toolbar, script tabs, a Script Pane, a Console Pane, a status bar, a text-size slider and context-sensitive Help.


PowerShell Run as Administrator

Script

Start-Process powershell -Verb runAs

PowerShell Commands

DSC Powershell Examples

Create File using DSC PowerShell Script - Part III

PowerShell DSC is one of my favorite topics to teach, because the technology is simply amazing. Usually I do not have enough time with a customer to teach all of the built-in resources. I would guess that the Script resource is one of the least understood.This sample has tested on PSVersion 4.0.

Step 1. Script Resource Log File Example

Here is an elegantly simple use of the Script resource. We have send Node (Server) Name and file contents as parameter to DSC Script. The code is its own documentation. Study it carefully.

configuration WinLogAutoGen
{ 
    param(
    
        [parameter(Mandatory=$true)]
        [string]    $Server,

        [parameter(Mandatory=$true)]
        [string]    $Contents
    )

    #import the module of DSC for using DSCResources.
    Import-DscResource -ModuleName PSDesiredStateConfiguration;

    node $Server
    {
        # use the file resource to create file.
        File windowsupdatelog{
            DestinationPath  = 'C:\windows\DynamicParameterDemo.log';
            Ensure = 'Present';
            Contents = $Contents ; 
        }
    }
 
}

#Create mof file
WinLogAutoGen -OutputPath D:\dsc-mof


#Apply mof File
Start-DscConfiguration -Wait -Verbose -Force -Path D:\dsc-mof

Notice the Write-Verbose statements. These are important for logging and output when the resource runs.

Step 2. Output



Step 3. Verify Output

Step for Verification.
  1. Connect to Server.
  2. Verify the content of DynamicParameterDemo.log file. PowerShell Command as below

Get-Content C:\Windows\DynamicParameterDemo.log

Note: We can verify the mof file content as well, PowerShell Command as below

Get-Content D:\dsc-mof\localhost.mof
IMP : Target nodes(Server) can apply only one MOF file.

Reference

Your Turn

Now it is your turn. Take this sample and implement your own script resources. Leave a comment below telling what you accomplished.

Best wishes on your adventure learning DSC!

Create File using DSC PowerShell Script - Part II

PowerShell DSC is one of my favorite topics to teach, because the technology is simply amazing. Usually I do not have enough time with a customer to teach all of the built-in resources. I would guess that the Script resource is one of the least understood.This sample has tested on PSVersion 4.0.

Step 1. Script Resource Log File Example

Here is an elegantly simple use of the Script resource. We have send file contents as parameter to DSC Script. The code is its own documentation. Study it carefully.

configuration WinLogAutoGen
{ 
    param(
        [parameter(Mandatory=$true)]
        [string]    $Contents
    )

    #import the module of DSC for using DSCResources.
    Import-DscResource -ModuleName PSDesiredStateConfiguration;

    # use the file resource to create file.
    File windowsupdatelog{
        DestinationPath  = 'C:\windows\DynamicParameterDemo.log';
        Ensure = 'Present';
        Contents = $Contents ; #'Some text lo';
    } 
}

#Create mof file
WinLogAutoGen -OutputPath D:\dsc-mof

#Apply mof File to Node (Server)
Start-DscConfiguration -Wait -Verbose -Force -Path D:\dsc-mof

Notice the Write-Verbose statements. These are important for logging and output when the resource runs.

Step 2. Output



Step 3. Verify Output

Verify the content of DynamicParameterDemo.log file. PowerShell Command as below

Get-Content C:\Windows\DynamicParameterDemo.log

Note: We can verify the mof file content as well, PowerShell Command as below

Get-Content D:\dsc-mof\localhost.mof
IMP : Target nodes(Server) can apply only one MOF file.

Reference

Your Turn

Now it is your turn. Take this sample and implement your own script resources. Leave a comment below telling what you accomplished.

Best wishes on your adventure learning DSC!

Create File using DSC PowerShell Script - Part I

PowerShell DSC is one of my favorite topics to teach, because the technology is simply amazing. Usually I do not have enough time with a customer to teach all of the built-in resources. I would guess that the Script resource is one of the least understood.This sample has tested on PSVersion 4.0.

Step 1. Script Resource Log File Example

Here is an elegantly simple use of the Script resource. We could make it more complex in many ways, but I prefer to start out with a simple use case first. The code is its own documentation. Study it carefully.

configuration WinLogAutoGen{
    param()
    #import the module of DSC for using DSCResources.
    Import-DscResource -ModuleName PSDesiredStateConfiguration;
    # use the file resource to create file.
    File windowsupdatelog{
        DestinationPath  = 'C:\Windows\windowsupdate2.log';
        Ensure = 'Present';
        Contents = 'Dev';
    }
 }
#Set mof file path in other word where to generate mof file.
WinLogAutoGen -Outputpath D:\Harshal;
#Run mof file in other word apply mof configuration to server.
Start-DscConfiguration -Wait -Verbose -Force -path D:\Harshal;

Notice the Write-Verbose statements. These are important for logging and output when the resource runs.

Step 2. Output



Reference

Your Turn

Now it is your turn. Take this sample and implement your own script resources. Leave a comment below telling what you accomplished.

Best wishes on your adventure learning DSC!

PowerShell Export-CSV

Script

Get-Service | Export-CSV c:\service.csv

Thursday, 27 July 2017

Windows PowerShell Useful Commands

Starting in Windows PowerShell 5.0, results of the Get-Command cmdlet display a Version column by default. A new Version property has been added to the CommandInfo class.

Commands using Get-Command

Command Description
Get-Help Displays information about Windows PowerShell commands and concepts.

Command Prompt Vs Windows Powershell

CMD PowerShell
Taskbar menu. Typing "cmd" Taskbar menu. Typing "powershell"
CMD is legacy in other word CMD is old. PowerShell as a shell is clearly intended as a replacement for CMD.
CMD does not run PowerShell commands PowerShell does run or use CMD commands.
The command shell is a separate software program that provides direct communication between the user and the operating system. PowerShell was actually built as several things: A mature , extensible automation platform and a modern administration shell. Windows PowerShell is a Windows command-line shell designed especially for system administrator.
CMD is used to create and edit batch (.bat) files (also called scripts). PowerShell is used to create and edit script (.ps1) files.

Monitoring

  • With your application up and running in Azure, you need to be able to monitor performance, watch for issues, and see how customers are using your app. Azure provides several monitoring options such as Visual Studio Application Insights, Azure Monitor, Log Analytics, System Center Operations Manager (SCOM).

Wednesday, 26 July 2017

Authentication

  • It is crucial to not only know who is using your applications, but also to prevent unauthorized access to your resources.
  • Azure provides several ways to authenticate your app clients,
  • Authenticate way such as Azure Active Directory (Azure AD), App Service Authentication.

Tuesday, 25 July 2017

Web Jobs

  • Doing regular jobs and batch work in the background. Now Azure Web Sites support a thing called "Azure WebJobs"
  • WebJobs are invoked in three different ways: on demand, continuously or on a schedule.
  • There is no additional cost to use WebJobs.

Notes

  • Web apps in Free mode can time out after 20 minutes if there are no requests to the scm (deployment) site and the web app's portal is not open in Azure. Requests to the actual site will not reset this.
  • Code for a continuous job needs to be written to run in an endless loop.
  • Continuous jobs run continuously only when the web app is up.
  • Basic and Standard modes offer the Always On feature which, when enabled, prevents web apps from becoming idle.
  • You can only debug continuously running WebJobs. Debugging scheduled or on-demand WebJobs is not supported.

Monday, 24 July 2017

Azure Files Vs Disks

Description Azure Blobs Azure File
Relationship with Azure VMs Required for booting (OS Disk) LR , GRS
Scope Exclusive/ Isolated to a single VM Shared across multiple VMs
Snapshots and Copy Yes No
Configuration Configured via portal/ management APIs and available at boot time Connect after boot (via net use on windows)
Built in authentication Built in authentication Set up authentication on net use
Cleanup Resources can be cleaned up with VM if needed Manually via standard file APIs or REST APIs
Access via REST Can only access as fixed formatted VHD (single blob) via REST. Files stored in VHD cannot be accessed via REST Individual files stored in share are accessible via REST
Max size 1 TB 5 TB File Share 1 TB File within Share
Max 8kb IOps 500 IOps 1000 IOps
  • Locally redundant storage (LRS) maintains three copies of your data. LRS is replicated three times within a single facility in a single region. LRS protects your data from normal hardware failures, but not from the failure of a single facility. LRS is offered at a discount.

  • Zone-redundant storage (ZRS) maintains three copies of your data. ZRS is replicated three times across two to three facilities, either within a single region or across two regions, providing higher durability than LRS. ZRS ensures that your data is durable within a single region. ZRS provides a higher level of durability than LRS. ZRS is currently available only for blobs. Once you have created your storage account and selected zone redundant replication, you cannot convert it to use to any other type of replication or vice versa.

  • Geo-redundant storage (GRS) is enabled for your storage account by default when you create it. GRS maintains six copies of your data. With GRS, your data is replicated three times within the primary region, and is also replicated three times in a secondary region hundreds of miles away from the primary region, providing the highest level of durability. In the event of a failure at the primary region, Azure Storage will failover to the secondary region. GRS ensures that your data is durable in two separate regions.

  • Read-access geo-redundant storage (RA-GRS) provides all of the benefits of geo-redundant storage noted above, and also allows read access to data at the secondary region in the event that the primary region becomes unavailable. Read-access geo-redundant storage is recommended for maximum availability in addition to durability.

Azure Active Directory

  • The Microsoft mutlitenent, cloud-based identity and access management service.
  • You can add single-sign on (SSO) to your Application by integrating with Azure AD.
  • You can access directory properties by using the Azure AD graph API directly or the Microsoft Graph API.
  • You can integrate with Azure AD support for the oAuth 2.0 authorization framework and open ID connect by using native HTTP/REST endpoints and multi-platform Azure AD authentication libraries.

When to use

  • When you want to provide an SSO experience, work with Graph-based data or just authenticate domain based users.

Reference URL

  • Service: https://azure.microsoft.com/en-in/services/active-directory/
  • Documentation: https://docs.microsoft.com/en-us/azure/active-directory/active-directory-whatis

Azure Files Vs Blobs

Description Azure Blobs Azure File
Durability Options LRS, ZRS, GRS (RA-GRS for higher availability) LR, GRS
Accessibility REST APIs SMB 2.1, REST APIs
Connectivity REST - World wide SMB 2.1 - Within Region, REST APIs- World wide
Directories Flat namespace however prefix listing can simulate virtual directories True directory objects
Case Sensitivity of Names Case Sensitive Case sensitive, but case preserving
Capacity Up to 500TB containers 5TB file shares
Throughput Up to 60 MB/s per blob Up to 60 MB/s per share
Object Size Up to 1 TB/Blob Up to 1 TB/File
Billing Capacity Based on bytes written Based on file size
  • Locally redundant storage (LRS) maintains three copies of your data. LRS is replicated three times within a single facility in a single region. LRS protects your data from normal hardware failures, but not from the failure of a single facility. LRS is offered at a discount.

  • Zone-redundant storage (ZRS) maintains three copies of your data. ZRS is replicated three times across two to three facilities, either within a single region or across two regions, providing higher durability than LRS. ZRS ensures that your data is durable within a single region. ZRS provides a higher level of durability than LRS. ZRS is currently available only for blobs. Once you have created your storage account and selected zone redundant replication, you cannot convert it to use to any other type of replication or vice versa.

  • Geo-redundant storage (GRS) is enabled for your storage account by default when you create it. GRS maintains six copies of your data. With GRS, your data is replicated three times within the primary region, and is also replicated three times in a secondary region hundreds of miles away from the primary region, providing the highest level of durability. In the event of a failure at the primary region, Azure Storage will failover to the secondary region. GRS ensures that your data is durable in two separate regions.

  • Read-access geo-redundant storage (RA-GRS) provides all of the benefits of geo-redundant storage noted above, and also allows read access to data at the secondary region in the event that the primary region becomes unavailable. Read-access geo-redundant storage is recommended for maximum availability in addition to durability.

Sunday, 23 July 2017

Azure Virtual Machines

  • As an infrastructure-as-a-service (IaaS) Provider, Azure lets you deploy to or migrate your application to either Windows or Linux VMs.
  • Azure Virtual Network, Azure Virtual Machines supports the deployment of windows to Linux VMs to Azure.
  • With VMs, you have total control over the configuration of the machine and you are responsible for all server software installation, configuration, maintenance and operating system patches.

When to use

  • Use Virtual Machines when you want full control over your application infrastructure or when you need to migrate on-premises application workloads to Azure without having to make changes.

Reference URL

  • Documentation: https://docs.microsoft.com/en-us/azure/virtual-machines/

Azure Functions (Serverless)

  • You simply want o execute your code in response to event or on a schedule without worrying about building out and managing a whole application or the infrastructure to run your code.
  • Azure Functions is a "serverless" style offesring that lets you write just code you need - with code execution that's triggered by HTTP requests, Webhooks, cloud service events or on a schedule.
  • With Azure Function, you can code in your development language of choice such as C#, F#, Node.js, Python or PHP.
  • With consumption-based billing, you pay only for the time that your code executes.

When to use

  • Azure Functions when you have code that is triggered by other Azure services by web-based events or schedule.
  • You can also use it when you do not need to overhead of a full project or when you only want to pay the time that your code runs.

Reference

  • Documentation: https://docs.microsoft.com/en-us/azure/azure-functions/

Azure Application Hosting

  • Azure provides several cloud-based compute offerings to run your application so that you don't have to worry about the infrastructure details.
  • You can easily scale up or scale out your resources as your application usage grows.

Azure Storage

  • Offers durable, highly available storage for blobs, queues, file and other kind of non-relational data.
  • Storage provides the storage foundation for VMs.

When to use

  • When your application stored non-relational data, such as key-value pairs (tables), blob files shares or message queue.

Reference URL

  • Service: https://azure.microsoft.com/en-in/services/storage/
  • Documentation: https://docs.microsoft.com/en-us/azure/storage/

Azure SQL Database

  • An Azure-based version of the Microsoft SQL server engine for storing relational tabular data in the cloud.
  • SQL Database provides predictable performance, scalability with no downtime, business continuity and data protection.

When to use

  • When your application requires data storage with referential integrity, transnational support and support for TSQL queries.

Reference URL

  • https://docs.microsoft.com/en-us/azure/sql-database/

Azure Service Fabric

  • Azure Service Fabric is a distributed systems platform that makes it easy to package, deploy and manage salable and reliable micro-services.
  • Provide sophisticated run-time for building distributed and scalable microservices.
  • Provide comprehensive application management capabilities for provisioning, deploying, monitoring, upgrading/ patching and deleting deployed applications.

When to use

  • Azure Service Fabric is a good choice when you are creating an application or rewriting an existing application to use a microservice architecture.
  • You need to more control over or direct access to the underlying infrastructure.

Reference URL

  • Documentation:https://azure.microsoft.com/en-in/services/service-fabric/

What is Azure

  • Azure is a complete cloud platform that can host your existing application infrastructure.
  • Provide compute-based services tailored for your application development needs or even argument your on-premises applications.
  • Azure integrates the cloud services that you need to develop, test, deploy and manage your application.

Where do I start to learn Azure?

  • All Azure Services, see the Documentation:https://azure.microsoft.com/en-in/services/.
  • You should decide on how to host your application in Azure?
  • Do you need to manage your entire infrastructure as a vitual machin (VM)?
  • Can you use the platform management facilities that Azure provides?
  • Maybe you need a server-less framework to host code execution only?
  • Your application will need cloud storage, which Azure provides several option for you.
  • You can take advantage of Azure enterprise authentication.

Elasticsearch - Nodes, clusters, and shards

Elastic Stack Video - Load your gun in short time.   Beginner's Crash Course to Ela...

Recent Post