Tuesday, September 21, 2021

Azure Cosmos DB

https://www.youtube.com/watch?v=p5rRGlKxNtk

Data Modelling in Azure Cosmos DB

Share Screen Recording - screenapp.io

 https://screenapp.io/#/dashboard

AZURE -204 (22 Sept 2021) - DAY3

 AZURE Functions   ---> LAMBDA


Trigger

--------------------

  • HTTP Trigger
  • Timer Trigger
  • CosmosDb Trigger
  • Blob Trigger
  • Queue Trigger

-----------------------------------------------------------------------------------

Consumption Plan -> Auto scaling happens automatically  -> Infinite Scaling

App Service Plan -> Cost Advantage, But Scaling is limited by auto scaling by App Service Plan

Premium Plan -> Unlimited Execution Duration, 

-----------------------------------------------------------------------------------

FunctionsApp is collection of Function


------------------------------------------------------------------------------------

VM - > Azure 

New VM 



Monday, September 20, 2021

AZURE -204 (21 Sept 2021) - DAY2

LRS - LOCALLY Redundant Storage (1n i Data Centre)

====================================

ZRS - Zone Redundant Storage (Across Zones)

======================================

GRS - Geo Redundant Storage (Acrosss Regions)


Paired Regions

=================================================================

Primary I create

Secondary , Not accessible, by user, But used by Azure themselves


=================================================================



LRS is by default Always ON

=================================================================

Replication vs Backup

Replication in Synchronous

it will give me 200 HTTP only when it saves on Secondary as well

Region Replication is Asynchronous

=================================================================

listing is allowed in CONTAINER, but not in BLOB Public Access


https://docs.microsoft.com/en-us/rest/api/storageservices/list-blobs


https://myaccount.blob.core.windows.net/mycontainer?restype=container&comp=list

=================================================================


https://stackoverflow.com/questions/26206993/how-to-revoke-shared-access-signature-in-azure-sdk/53158363#53158363


SAS not based on SAP - can't be revoked:

If you are using ad hoc URIs, you have three options. You can issue SAS tokens with short expiration policies and wait for the SAS to expire. You can rename or delete the resource (assuming the token was scoped to a single object). You can change the storage account keys. This last option can have a significant impact, depending on how many services are using that storage account, and probably isn't something you want to do without some planning.

SAS based on SAP - can be revoked by revoking SAP:

If you are using a SAS derived from a Stored Access Policy, you can remove access by revoking the Stored Access Policy – you can just change it so it has already expired, or you can remove it altogether. This takes effect immediately, and invalidates every SAS created using that Stored Access Policy. Updating or removing the Stored Access Policy may impact people accessing that specific container, file share, table, or queue via SAS, but if the clients are written so they request a new SAS when the old one becomes invalid, this will work fine.

Best practice:

Because using a SAS derived from a Stored Access Policy gives you the ability to revoke that SAS immediately, it is the recommended best practice to always use Stored Access Policies when possible.

================================================================


Access Tier

HOT Tier ---> Frequently Accessed 

Cool Tier -->  Infrequently Accessed

Archive  --> Archival data (rarely accessed)

================================

Premium -> Always Frequently--> SSD Tier

================================

Access Tier Lifecycle 
Lifecycle Management

=======================================================
By default Files are in HOT Tier

========================================================

Hot Tier is costly, but R/W Operations are cheap
Cool Tier is less costly, but R/W Operations are costier
========================================================

In your 1 Subscription, You can have 200 Storage Accounts

========================================================

https://docs.microsoft.com/en-us/azure/storage/blobs/soft-delete-blob-overview

========================================================

COSMOS DB  ???


https://volosoft.com/blog/Introduction-to-Azure-Cosmos-DB

Azure Cosmos DB supports 5 type of APIs.

  • SQL API (Json)
  • MongoDB API (Bson)
  • Gremlin API (Graph)
  • Table API (Key-Value)
  • Cassandra API (columnar)

========================================================

Consistency

Replication comes with a choice of consistency. So, when one instance of your app writes data to a write-region, Azure needs to replicate this data to other regions.

Azure Cosmos DB offers 5 type of consistency levels. It means, you need to select how Azure should replicate your data between your Azure Cosmos DB regions. Let’s see what are those consistency levels:

Strong

In this model, there are no dirty reads. It means, when a data is updated, everybody will read the old value until the data is replicated to all regions. This is the slowest option.

Bounded Staleness

In this option, you can define period of time or update count for the staleness of your data. You can say that, no dirty reads for 1 minute or no dirty reads for data updated more than 5 times. When you set the time option to 0, it will be exactly same as Strong consistency option.

Session

In this option, no dirty reads are possible for writers but dirty reads are possible for readers. This is the default option. So, if you are the one writing the data, you can read that data. But for others, they can read stale data for a while.

Consistent Prefix

In this option dirt-reads are possible but they are always on order. So, if a data is updated with the values 1,2,3 in order, readers always see the updated data in this order. No one will see the value 3 before 2.

Eventual

In this option, dirty reads are possible and there is no guarantee of order. So, if a data is updated with the values 1,2,3 in order, a reader can see value 3 before seeing value 2. But, this is the fastest option.

Here is a commonly used image for showing consistency options of Azure Cosmos DB:

img

Types of Deployment Strategies

https://medium.com/geekculture/what-is-your-deployment-strategy-51811b4ed973

Sunday, September 19, 2021

AZURE -204 (21 Sept 2021) - DAY1

- .NET 3.1/5
- Visual Studio 2019 Community (Azure Development, Cross-Platform Development, Web Development)
- Visual Studio Code
- Azure CLI
- Azure PowerShell
- Docker Desktop
- Azure Storage Explorer
- Azure CosmosDB Emulator
- Node JS 16.x





========================================================================

10% IAAS
90% PAAS in Exam AZ-204


Skills Measured - AZ 204


========================================================================


"App Service Web Apps" -  PAAS -> Deploy Apps (NodeJS, JAVA) from IDE
No VM management needed
Scalable easily

Web Job

Logical Sandbox  --> Logical VM

App Service 
1 App Service --> Multiple Web Apps
App Service Plan -> Feature of Logical VM --> Size, External Domain, CPU

Free Plan
Standard Plan
Premium Plan

========================================================================

*.azurewebsites.net

If You want Privacy -> Isolated N/W App Service Plan

Inbound IP -> Whitelisting

=========================================================================

S1 Plan -- App Service Plan

=========================================================================
Authentication/Authorization   is External Service which will be added to my "App Service"
=========================================================================

Hybrid Connection ???

App Service Hybrid Connection
App Service --> DB inside (On Premises)  via Agent 
===============================================
2 Flavours of Azure Command Line

CLI 
Power Shell

==============================================

1 Question from this
Order list of CLI Commands to create a App Service - Web 

==============================================

App Service --> Code
App Service --> Docker
App Service -> Configuration & Monitoring

==============================================
Docker Linux - App



































# generate a unique name and store as a shell variable
webappname=mywebapp$RANDOM

# create a resource group
az group create --location westeurope --name myResourceGroup

# create an App Service plan
az appservice plan create --name $webappname --resource-group myResourceGroup --sku FREE

# create a Web App
az webapp create --name $webappname --resource-group myResourceGroup --plan $webappname

# store a repository url as a shell variable
gitrepo=https://github.com/Azure-Samples/php-docs-hello-world

# deploy code from a Git repository

az webapp deployment source config --name $webappname --resource-group myResourceGroup --repo-url $gitrepo --branch master --manual-integration

=======================================================================

Staging Slot

Production 

=================================================================
"SLOT" is inside App Service Plan, Not in another VM or so

You can divide load between 2 SLOTS - Weightage
=================================================================

Linux :Zip How to Zip only Files in Zip File in Linux

https://superuser.com/questions/841642/zip-command-on-linux-how-to-force-to-zip-only-files-and-not-whole-directories-st


Use the -j (junk-paths) option.


@LAPTOP MINGW64 ~/Desktop/Devops/EmailCount

$ zip -j 12-18Sept2021.zip "12-18Sept 2021/*"

  adding: 12-9-2021.csv (164 bytes security) (deflated 45%)

  adding: 13-9-2021.csv (164 bytes security) (deflated 45%)

  adding: 14-9-2021.csv (164 bytes security) (deflated 68%)

  adding: 15-9-2021.csv (164 bytes security) (deflated 67%)

  adding: 16-9-2021.csv (164 bytes security) (deflated 66%)

  adding: 17-9-2021.csv (164 bytes security) (deflated 69%)

  adding: 18-9-2021.csv (164 bytes security) (deflated 66%)

  adding: 19-9-2021.csv (164 bytes security) (deflated 45%)

  adding: 20-9-2021.csv (164 bytes security) (deflated 45%)


Azure - Pipeline - Add Approver for Stage

https://learn.microsoft.com/en-us/azure/devops/pipelines/process/approvals?view=azure-devops&tabs=check-pass