Saturday, March 19, 2022

Azure - How Tp

 Azure CLI Setup

1) Download  

https://docs.microsoft.com/en-us/cli/azure/install-azure-cli-windows?tabs=azure-cli

2) Install 

3) Launch powershelll --> az login

Commands

Resource Group                            az group
Virtual machines                            az vm

Storage accounts                            az storage account

Key vault                                        az keyvault

Web Applications                            az webapp

SQL databases                                az sql server

Cosmos DB                                    az cosmosdb


Help

az find secret
az network nsg --help
az interactive            --> interactive mode
az feedback

Create Service Plan


az appservice plan create -n ASP-123dev  -g RG-123-pay --app-service-environment  ase-123--sku I1v2 --subscription 123121212 --is-linux   --location us-east-2 



Sunday, October 24, 2021

React JS - How To

  • Create React App
  • Components  
    • Functional 
    • Class
  • JSX
  • Props and State
  • useState and useEfect
  • Components life cycle methods
  • Conditional Rendering
  • List & Keys
  • Basic Form handling
  • React Project Structure
  • Routing React Router
  • Programmatic Navigation
  • Set-up JSON Server
  • react CRUD operations
  • React Search Filter
  • React Hooks

Tools: 

nodejs installed. v14.16.0


  • Launch VS Code
  • Go to Terminal
  • npx create-react-app oms-ui


Folder structure




Delete default files listed below




Remove from App.js file



Sunday, September 5, 2021

azure function with docker

 {

    "$schema""http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
    "contentVersion""1.0.0.0",
    "parameters": {
        "subscriptionId": {
            "type""string"
        },
        "name": {
            "type""string"
        },
        "location": {
            "type""string"
        },
        "hostingPlanName": {
            "type""string"
        },
        "serverFarmResourceGroup": {
            "type""string"
        },
        "alwaysOn": {
            "type""bool"
        },
        "storageAccountName": {
            "type""string"
        },
        "use32BitWorkerProcess": {
            "type""bool"
        },
        "linuxFxVersion": {
            "type""string"
        },
        "dockerRegistryUrl": {
            "type""string"
        },
        "dockerRegistryUsername": {
            "type""string"
        },
        "dockerRegistryPassword": {
            "type""securestring"
        },
        "dockerRegistryStartupCommand": {
            "type""string"
        }
    },
    "variables": {},
    "resources": [
        {
            "apiVersion""2018-11-01",
            "name""[parameters('name')]",
            "type""Microsoft.Web/sites",
            "kind""functionapp,linux",
            "location""[parameters('location')]",
            "tags": {},
            "dependsOn": [],
            "properties": {
                "name""[parameters('name')]",
                "siteConfig": {
                    "appSettings": [
                        {
                            "name""FUNCTIONS_EXTENSION_VERSION",
                            "value""~3"
                        },
                        {
                            "name""DOCKER_REGISTRY_SERVER_URL",
                            "value""[parameters('dockerRegistryUrl')]"
                        },
                        {
                            "name""DOCKER_REGISTRY_SERVER_USERNAME",
                            "value""[parameters('dockerRegistryUsername')]"
                        },
                        {
                            "name""DOCKER_REGISTRY_SERVER_PASSWORD",
                            "value""[parameters('dockerRegistryPassword')]"
                        },
                        {
                            "name""WEBSITES_ENABLE_APP_SERVICE_STORAGE",
                            "value""false"
                        },
                        {
                            "name""APPINSIGHTS_INSTRUMENTATIONKEY",
                            "value""c5ac382d-ff86-40f6-bba3-5d808c42edb5"
                        },
                        {
                            "name""APPLICATIONINSIGHTS_CONNECTION_STRING",
                            "value""InstrumentationKey=xxxxxxxxxxxx;IngestionEndpoint=https://westus2-0.in.applicationinsights.azure.com/"
                        },
                        {
                            "name""AzureWebJobsStorage",
                            "value""[concat('DefaultEndpointsProtocol=https;AccountName=',parameters('storageAccountName'),';AccountKey=',listKeys(resourceId('55954b78-5022-4a56-9fdc-54207b3a74ab','swamy-resource-grp','Microsoft.Storage/storageAccounts', parameters('storageAccountName')), '2019-06-01').keys[0].value,';EndpointSuffix=','core.windows.net')]"
                        }
                    ],
                    "use32BitWorkerProcess""[parameters('use32BitWorkerProcess')]",
                    "linuxFxVersion""[parameters('linuxFxVersion')]",
                    "appCommandLine""[parameters('dockerRegistryStartupCommand')]",
                    "alwaysOn""[parameters('alwaysOn')]"
                },
                "serverFarmId""[concat('/subscriptions/', parameters('subscriptionId'),'/resourcegroups/', parameters('serverFarmResourceGroup'), '/providers/Microsoft.Web/serverfarms/', parameters('hostingPlanName'))]",
                "clientAffinityEnabled"false
            }
        }
    ]
}

Saturday, August 28, 2021

azure function app with storage

 {

    "$schema""http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
    "contentVersion""1.0.0.0",
    "parameters": {
        "location": {
            "type""string"
        },
        "storageAccountName": {
            "type""string"
        },
        "accountType": {
            "type""string"
        },
        "kind": {
            "type""string"
        },
        "accessTier": {
            "type""string"
        },
        "minimumTlsVersion": {
            "type""string"
        },
        "supportsHttpsTrafficOnly": {
            "type""bool"
        },
        "allowBlobPublicAccess": {
            "type""bool"
        },
        "allowSharedKeyAccess": {
            "type""bool"
        },
        "defaultOAuth": {
            "type""bool"
        },
        "networkAclsBypass": {
            "type""string"
        },
        "networkAclsDefaultAction": {
            "type""string"
        },
        "routingChoice": {
            "type""string"
        },
        "isHnsEnabled": {
            "type""bool"
        },
        "isContainerSoftDeleteEnabled": {
            "type""bool"
        },
        "containerSoftDeleteRetentionDays": {
            "type""int"
        },
        "isShareSoftDeleteEnabled": {
            "type""bool"
        },
        "shareSoftDeleteRetentionDays": {
            "type""int"
        }
    },
    "variables": {},
    "resources": [
        {
            "name""[parameters('storageAccountName')]",
            "type""Microsoft.Storage/storageAccounts",
            "apiVersion""2021-06-01",
            "location""[parameters('location')]",
            "properties": {
                "accessTier""[parameters('accessTier')]",
                "minimumTlsVersion""[parameters('minimumTlsVersion')]",
                "supportsHttpsTrafficOnly""[parameters('supportsHttpsTrafficOnly')]",
                "allowBlobPublicAccess""[parameters('allowBlobPublicAccess')]",
                "allowSharedKeyAccess""[parameters('allowSharedKeyAccess')]",
                "defaultToOAuthAuthentication""[parameters('defaultOAuth')]",
                "networkAcls": {
                    "bypass""[parameters('networkAclsBypass')]",
                    "defaultAction""[parameters('networkAclsDefaultAction')]",
                    "ipRules": []
                },
                "routingPreference": {
                    "routingChoice""[parameters('routingChoice')]",
                    "publishMicrosoftEndpoints"false,
                    "publishInternetEndpoints"false
                },
                "isHnsEnabled""[parameters('isHnsEnabled')]"
            },
            "dependsOn": [],
            "sku": {
                "name""[parameters('accountType')]"
            },
            "kind""[parameters('kind')]",
            "tags": {
                "name""function-app-storage-acc"
            }
        },
        {
            "name""[concat(parameters('storageAccountName'), '/default')]",
            "type""Microsoft.Storage/storageAccounts/blobServices",
            "apiVersion""2021-06-01",
            "properties": {
                "containerDeleteRetentionPolicy": {
                    "enabled""[parameters('isContainerSoftDeleteEnabled')]",
                    "days""[parameters('containerSoftDeleteRetentionDays')]"
                }
            },
            "dependsOn": [
                "[concat('Microsoft.Storage/storageAccounts/', parameters('storageAccountName'))]"
            ]
        },
        {
            "name""[concat(parameters('storageAccountName'), '/default')]",
            "type""Microsoft.Storage/storageAccounts/fileservices",
            "apiVersion""2021-06-01",
            "properties": {
                "shareDeleteRetentionPolicy": {
                    "enabled""[parameters('isShareSoftDeleteEnabled')]",
                    "days""[parameters('shareSoftDeleteRetentionDays')]"
                }
            },
            "dependsOn": [
                "[concat('Microsoft.Storage/storageAccounts/', parameters('storageAccountName'))]",
                "[concat(concat('Microsoft.Storage/storageAccounts/', parameters('storageAccountName')), '/blobServices/default')]"
            ]
        }
    ],
    "outputs": {}
}

Tuesday, August 24, 2021

azure function- arm

 Function App

by Microsoft
Subscription    xxxxxxxxxxxxxxb
Resource Group    xxxxxxxxxxxxx-grp
Name
poc-swamyt
Runtime stack
Java 8.0
Tags
name: function-app
Storage account
storageaccountoctopaa67
Tags
name: function-app
Plan type
App service plan
Name
ASP-xxxx-test-app-svc-8941
Operating System
Linux
Region
East US 2
SKU
Premium V2
Size
Small
ACU
210 total ACU
Memory
3.5 GB memory
Application Insights
Enabled
Name
xxxx-app-insights
Region
West US 2

{
    "$schema""https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
    "contentVersion""1.0.0.0",
    "parameters": {
        "sites_poc_swamyt_name": {
            "defaultValue""poc-swamyt",
            "type""String"
        },
        "serverfarms_ASP_octopus_test_app_svc_8941_externalid": {
            "defaultValue""/subscriptions/xxxxx-xxx-xx-xx-xxx/resourceGroups/xxx-resource-grp/providers/Microsoft.Web/serverfarms/ASP-xxxx-test-app-svc-8941",
            "type""String"
        }
    },
    "variables": {},
    "resources": [
        {
            "type""Microsoft.Web/sites",
            "apiVersion""2021-01-15",
            "name""[parameters('sites_poc_swamyt_name')]",
            "location""East US 2",
            "tags": {
                "name""function-app"
            },
            "kind""functionapp,linux",
            "properties": {
                "enabled"true,
                "hostNameSslStates": [
                    {
                        "name""[concat(parameters('sites_poc_swamyt_name'), '.azurewebsites.net')]",
                        "sslState""Disabled",
                        "hostType""Standard"
                    },
                    {
                        "name""[concat(parameters('sites_poc_swamyt_name'), '.scm.azurewebsites.net')]",
                        "sslState""Disabled",
                        "hostType""Repository"
                    }
                ],
                "serverFarmId""[parameters('serverfarms_ASP_xxxx_test_app_svc_8941_externalid')]",
                "reserved"true,
                "isXenon"false,
                "hyperV"false,
                "siteConfig": {
                    "numberOfWorkers"1,
                    "linuxFxVersion""Java|8",
                    "acrUseManagedIdentityCreds"false,
                    "alwaysOn"true,
                    "http20Enabled"false,
                    "functionAppScaleLimit"0,
                    "minimumElasticInstanceCount"0
                },
                "scmSiteAlsoStopped"false,
                "clientAffinityEnabled"false,
                "clientCertEnabled"false,
                "clientCertMode""Required",
                "hostNamesDisabled"false,
                "customDomainVerificationId""xxxxxxx",
                "containerSize"1536,
                "dailyMemoryTimeQuota"0,
                "keyVaultReferenceIdentity""SystemAssigned",
                "httpsOnly"false,
                "redundancyMode""None",
                "storageAccountRequired"false
            }
        },
        {
            "type""Microsoft.Web/sites/basicPublishingCredentialsPolicies",
            "apiVersion""2021-01-15",
            "name""[concat(parameters('sites_poc_swamyt_name'), '/ftp')]",
            "location""East US 2",
            "dependsOn": [
                "[resourceId('Microsoft.Web/sites', parameters('sites_poc_swamyt_name'))]"
            ],
            "tags": {
                "name""function-app"
            },
            "properties": {
                "allow"true
            }
        },
        {
            "type""Microsoft.Web/sites/basicPublishingCredentialsPolicies",
            "apiVersion""2021-01-15",
            "name""[concat(parameters('sites_poc_swamyt_name'), '/scm')]",
            "location""East US 2",
            "dependsOn": [
                "[resourceId('Microsoft.Web/sites', parameters('sites_poc_swamyt_name'))]"
            ],
            "tags": {
                "name""function-app"
            },
            "properties": {
                "allow"true
            }
        },
        {
            "type""Microsoft.Web/sites/config",
            "apiVersion""2021-01-15",
            "name""[concat(parameters('sites_poc_swamyt_name'), '/web')]",
            "location""East US 2",
            "dependsOn": [
                "[resourceId('Microsoft.Web/sites', parameters('sites_poc_swamyt_name'))]"
            ],
            "tags": {
                "name""function-app"
            },
            "properties": {
                "numberOfWorkers"1,
                "defaultDocuments": [
                    "Default.htm",
                    "Default.html",
                    "Default.asp",
                    "index.htm",
                    "index.html",
                    "iisstart.htm",
                    "default.aspx",
                    "index.php"
                ],
                "netFrameworkVersion""v4.0",
                "linuxFxVersion""Java|8",
                "requestTracingEnabled"false,
                "remoteDebuggingEnabled"false,
                "httpLoggingEnabled"false,
                "acrUseManagedIdentityCreds"false,
                "logsDirectorySizeLimit"35,
                "detailedErrorLoggingEnabled"false,
                "publishingUsername""$poc-swamyt",
                "azureStorageAccounts": {},
                "scmType""None",
                "use32BitWorkerProcess"false,
                "webSocketsEnabled"false,
                "alwaysOn"true,
                "managedPipelineMode""Integrated",
                "virtualApplications": [
                    {
                        "virtualPath""/",
                        "physicalPath""site\\wwwroot",
                        "preloadEnabled"true
                    }
                ],
                "loadBalancing""LeastRequests",
                "experiments": {
                    "rampUpRules": []
                },
                "autoHealEnabled"false,
                "vnetRouteAllEnabled"false,
                "vnetPrivatePortsCount"0,
                "localMySqlEnabled"false,
                "ipSecurityRestrictions": [
                    {
                        "ipAddress""xx/32",
                        "action""Allow",
                        "tag""Default",
                        "priority"2147483641,
                        "name""Global Innovation Lab"
                    },
                    
                    {
                        "ipAddress""Any",
                        "action""Deny",
                        "priority"2147483647,
                        "name""Deny all",
                        "description""Deny all access"
                    }
                ],
                "scmIpSecurityRestrictions": [
                    {
                        "ipAddress""xxxx/32",
                        "action""Allow",
                        "tag""Default",
                        "priority"2147483641,
                        "name""Global Innovation Lab"
                    },
                    
                    
                    {
                        "ipAddress""Any",
                        "action""Deny",
                        "priority"2147483647,
                        "name""Deny all",
                        "description""Deny all access"
                    }
                ],
                "scmIpSecurityRestrictionsUseMain"false,
                "http20Enabled"false,
                "minTlsVersion""1.2",
                "scmMinTlsVersion""1.0",
                "ftpsState""AllAllowed",
                "preWarmedInstanceCount"0,
                "functionAppScaleLimit"0,
                "functionsRuntimeScaleMonitoringEnabled"false,
                "minimumElasticInstanceCount"0
            }
        },
        {
            "type""Microsoft.Web/sites/hostNameBindings",
            "apiVersion""2021-01-15",
            "name""[concat(parameters('sites_poc_swamyt_name'), '/', parameters('sites_poc_swamyt_name'), '.azurewebsites.net')]",
            "location""East US 2",
            "dependsOn": [
                "[resourceId('Microsoft.Web/sites', parameters('sites_poc_swamyt_name'))]"
            ],
            "properties": {
                "siteName""poc-swamyt",
                "hostNameType""Verified"
            }
        },
        {
            "type""Microsoft.Web/sites/snapshots",
            "apiVersion""2015-08-01",
            "name""[concat(parameters('sites_poc_swamyt_name'), '/2021-08-24T12_56_50_4269006')]",
            "dependsOn": [
                "[resourceId('Microsoft.Web/sites', parameters('sites_poc_swamyt_name'))]"
            ]
        }
    ]
}