brain/02 Projekte/Koogle.md

135 lines
11 KiB
Markdown
Raw Permalink Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

---
tags:
- projekt
status: aktiv
erstellt: 2026-04-12
title: Koogle
---
# Koogle
## Ziel
## Status
In Bearbeitung
## Nächste Schritte
## Notizen
[https://KoogleWeb20251231130827.azurewebsites.net](https://KoogleWeb20251231130827.azurewebsites.net)
Diagnose: [https://koogleweb20251231130827-hdf7bmewhka0hsdd.scm.westeurope-01.azurewebsites.net/detectors](https://koogleweb20251231130827-hdf7bmewhka0hsdd.scm.westeurope-01.azurewebsites.net/detectors)
Web-Tools: [Azure App Service](https://koogleweb20251231130827-hdf7bmewhka0hsdd.scm.westeurope-01.azurewebsites.net/newui)
# Subscription-ID:
![](blob:https://ka-note.azurewebsites.net/025a05b2-7be2-41ff-95c3-7893562a84d8)
f1332eb1-392f-4b16-9ede-7905848ef248
admin-d-chrka als Contributor eingerichtet
![[Pasted image 20260412172605.png]]
```
az ad signed-in-user show
```
> {\   ["@odata.context":](mailto:%22@odata.context%22:) "[https://graph.microsoft.com/v1.0/$metadata#users/$entity](https://graph.microsoft.com/v1.0/$metadata#users/$entity)",\   "businessPhones": \[\],\   "displayName": "Admin D-Chrka",\   "givenName": "Admin",\   "id": "70f83097-e12a-48a6-96b4-15760268c994",\   "jobTitle": null,\   "mail": null,\   "mobilePhone": null,\   "officeLocation": null,\   "preferredLanguage": null,\   "surname": "D-Chrka",\   "userPrincipalName": ["](mailto:%22Admin-D-Chrka@krah-gruppe.de%22)[Admin-D-Chrka@krah-gruppe.de](mailto:Admin-D-Chrka@krah-gruppe.de)["](mailto:%22Admin-D-Chrka@krah-gruppe.de%22)\ }
Azure CLI installieren, [Installieren der Azure CLI unter Windows | Microsoft Learn](https://learn.microsoft.com/de-de/cli/azure/install-azure-cli-windows?view=azure-cli-latest&pivots=msi-powershell)
Resource group:
> {\   "id": "/subscriptions/f1332eb1-392f-4b16-9ede-7905848ef248/resourceGroups/rg-koogle-prod",\   "location": "westeurope",\   "managedBy": null,\   "name": "rg-koogle-prod",\   "properties": {\     "provisioningState": "Succeeded"\   },\   "tags": null,\   "type": "Microsoft.Resources/resourceGroups"\ }
App Service Plan (Linux, B1 reicht meist für wenige User)
> {\   "asyncScalingEnabled": false,\   "elasticScaleEnabled": false,\   "freeOfferExpirationTime": "2026-01-30T11:45:50.8",\   "geoRegion": "West Europe",\   "hyperV": false,\   "id": "/subscriptions/f1332eb1-392f-4b16-9ede-7905848ef248/resourceGroups/rg-koogle-prod/providers/Microsoft.Web/serverfarms/asp-koogle-prod",\   "isCustomMode": false,\   "isSpot": false,\   "isXenon": false,\   "kind": "linux",\   "location": "westeurope",\   "maximumElasticWorkerCount": 1,\   "maximumNumberOfWorkers": 0,\   "name": "asp-koogle-prod",\   "numberOfSites": 0,\   "numberOfWorkers": 1,\   "perSiteScaling": false,\   "provisioningState": "Succeeded",\   "reserved": true,\   "resourceGroup": "rg-koogle-prod",\   "sku": {\     "capacity": 1,\     "family": "B",\     "name": "B1",\     "size": "B1",\     "tier": "Basic"\   },\   "status": "Ready",\   "subscription": "f1332eb1-392f-4b16-9ede-7905848ef248",\   "targetWorkerCount": 0,\   "targetWorkerSizeId": 0,\   "type": "Microsoft.Web/serverfarms",\   "zoneRedundant": false\ }
az webapp identity assign -g $RgName -n $WebAppName
$principalId = az webapp show -g $RgName -n $WebAppName --query identity.principalId -o tsv
> {
>
> "principalId": "bebabb0b-1f5e-4917-bdde-7bbb70139248",\   "tenantId": "94cf90d7-e9ff-49a1-bc3b-a5b94d3cc8ca",\   "type": "SystemAssigned",\   "userAssignedIdentities": null\ }
## SQL-Server
az sql server create -g $RgName -n $SqlServerName -l $Location -u "sqladmin" -p (New-Guid).Guid
> {\   "administratorLogin": "sqladmin",\   "administratorLoginPassword": null,\   "administrators": null,\   "createMode": null,\   "externalGovernanceStatus": "Disabled",\   "federatedClientId": null,\   "fullyQualifiedDomainName": "[sql-koogle-prod.database.windows.net](http://sql-koogle-prod.database.windows.net)",\   "id": "/subscriptions/f1332eb1-392f-4b16-9ede-7905848ef248/resourceGroups/rg-koogle-prod/providers/Microsoft.Sql/servers/sql-koogle-prod",  \   "identity": null,\   "isIPv6Enabled": null,\   "keyId": null,\   "kind": "v12.0",\   "location": "westeurope",\   "minimalTlsVersion": "1.2",\   "name": "sql-koogle-prod",\   "primaryUserAssignedIdentityId": null,\   "privateEndpointConnections": \[\],\   "publicNetworkAccess": "Enabled",\   "resourceGroup": "rg-koogle-prod",\   "restrictOutboundNetworkAccess": "Disabled",\   "retentionDays": -1,\   "state": "Ready",\   "tags": null,\   "type": "Microsoft.Sql/servers",\   "version": "12.0",\   "workspaceFeature": null\ }
```
az sql server update `
-g $RgName `
-n $SqlServerName `
--admin-password "Magister7000#"
```
Anmeldung im Azure-Portal muss als admin-d-chrka erfolgen
dann User per SQL anlegen:
```
CREATE USER [KoogleWeb20251231130827] FROM EXTERNAL PROVIDER;
ALTER ROLE db_datareader ADD MEMBER [KoogleWeb20251231130827];
ALTER ROLE db_datawriter ADD MEMBER [KoogleWeb20251231130827];
```
## SQL-DB
az sql db create -g $RgName -s $SqlServerName -n $SqlDbName --service-objective S0
> {\   "autoPauseDelay": null,\   "availabilityZone": "NoPreference",\   "catalogCollation": "SQL_Latin1_General_CP1_CI_AS",\   "collation": "SQL_Latin1_General_CP1_CI_AS",\   "createMode": null,\   "creationDate": "2025-12-31T12:42:38+00:00",\   "currentBackupStorageRedundancy": "Geo",\   "currentServiceObjectiveName": "S0",\   "currentSku": {\     "capacity": 10,\     "family": null,\     "name": "Standard",\     "size": null,\     "tier": "Standard"\   },\   "databaseId": "f3dcbbb9-8a40-4e02-b40c-a8fc4991c04b",\   "defaultSecondaryLocation": "northeurope",\   "earliestRestoreDate": null,\   "edition": "Standard",\   "elasticPoolId": null,\   "elasticPoolName": null,\   "encryptionProtector": null,\   "encryptionProtectorAutoRotation": null,\   "failoverGroupId": null,\   "federatedClientId": null,\   "freeLimitExhaustionBehavior": null,\   "highAvailabilityReplicaCount": null,\   "id": "/subscriptions/f1332eb1-392f-4b16-9ede-7905848ef248/resourceGroups/rg-koogle-prod/providers/Microsoft.Sql/servers/sql-koogle-prod/databases/db-koogle",\   "identity": null,\   "isInfraEncryptionEnabled": false,\   "keys": null,\   "kind": "v12.0,user",\   "ledgerOn": false,\   "licenseType": null,\   "location": "westeurope",\   "longTermRetentionBackupResourceId": null,\   "maintenanceConfigurationId": "/subscriptions/f1332eb1-392f-4b16-9ede-7905848ef248/providers/Microsoft.Maintenance/publicMaintenanceConfigurations/SQL_Default",\   "managedBy": null,\   "manualCutover": null,\   "maxLogSizeBytes": null,\   "maxSizeBytes": 268435456000,\   "minCapacity": null,\   "name": "db-koogle",\   "pausedDate": null,\   "performCutover": null,\   "preferredEnclaveType": null,\   "readScale": "Disabled",\   "recoverableDatabaseId": null,\   "recoveryServicesRecoveryPointId": null,\   "requestedBackupStorageRedundancy": "Geo",\   "requestedServiceObjectiveName": "S0",\   "resourceGroup": "rg-koogle-prod",\   "restorableDroppedDatabaseId": null,\   "restorePointInTime": null,\   "resumedDate": null,\   "sampleName": null,\   "secondaryType": null,\   "sku": {\     "capacity": 10,\     "family": null,\     "name": "Standard",\     "size": null,\     "tier": "Standard"\   },\   "sourceDatabaseDeletionDate": null,\   "sourceDatabaseId": null,\   "sourceResourceId": null,\   "status": "Online",\   "tags": null,\   "type": "Microsoft.Sql/servers/databases",\   "useFreeLimit": null,\   "zoneRedundant": false\ }
### SQL-Admin
az sql server ad-admin create \`
\-g $RgName -s $SqlServerName \`
\--display-name $AadAdminDisplay \`
\--object-id $AadAdminObjectId
> {\   "administratorType": "ActiveDirectory",\   "azureAdOnlyAuthentication": null,\   "id": "/subscriptions/f1332eb1-392f-4b16-9ede-7905848ef248/resourceGroups/rg-koogle-prod/providers/Microsoft.Sql/servers/sql-koogle-prod/administrators/ActiveDirectory",\   "login": "Admin D-Chrka",\   "name": "ActiveDirectory",\   "resourceGroup": "rg-koogle-prod",\   "sid": "70f83097-e12a-48a6-96b4-15760268c994",\   "tenantId": "94cf90d7-e9ff-49a1-bc3b-a5b94d3cc8ca",\   "type": "Microsoft.Sql/servers"\ }
### Zugriff auf SQL vom NB erlauben
```
# Firewall-Regel für dein Notebook (lokaler Zugriff/Tools wie DataGrip)
$myIp = (Invoke-RestMethod -Uri "https://api.ipify.org")
az sql server firewall-rule create -g $RgName -s $SqlServerName -n "allow-notebook" --start-ip-address $myIp --end-ip-address $myIp
```
> {\   "endIpAddress": "91.63.233.49",\   "id": "/subscriptions/f1332eb1-392f-4b16-9ede-7905848ef248/resourceGroups/rg-koogle-prod/providers/Microsoft.Sql/servers/sql-koogle-prod/firewallRules/allow-notebook",\   "name": "allow-notebook",\   "resourceGroup": "rg-koogle-prod",\   "startIpAddress": "91.63.233.49",\   "type": "Microsoft.Sql/servers/firewallRules"\ }
[https://portal.azure.com/#@krahgruppe.onmicrosoft.com/resource/subscriptions/f1332eb1-392f-4b16-9ede-7905848ef248/resourcegroups/rg-koogle-prod/providers/microsoft.sql/servers/sql-koogle-prod/networking](https://portal.azure.com/#@krahgruppe.onmicrosoft.com/resource/subscriptions/f1332eb1-392f-4b16-9ede-7905848ef248/resourcegroups/rg-koogle-prod/providers/microsoft.sql/servers/sql-koogle-prod/networking)
## App Insights
az monitor app-insights component create -g $RgName -l $Location -a $AppInsightsName
> {- Installing ..\   "appId": "0490e6aa-f192-4fe9-aefb-0ad9ff66d08c",\   "applicationId": "ai-koogle-prod",\   "applicationType": "web",\   "connectionString": "InstrumentationKey=b3f53de2-82d7-4149-a468-dbdc486b919c;IngestionEndpoint=[https://westeurope-5.in.applicationinsights.azure.com/;LiveEndpoint=https://westeurope.livediagnostics.monitor.azure.com/;ApplicationId=0490e6aa-f192-4fe9-aefb-0ad9ff66d08c](https://westeurope-5.in.applicationinsights.azure.com/;LiveEndpoint=https://westeurope.livediagnostics.monitor.azure.com/;ApplicationId=0490e6aa-f192-4fe9-aefb-0ad9ff66d08c)",\   "creationDate": "2025-12-31T12:47:36.840819+00:00",\   "disableIpMasking": null,\   "etag": "\\"a402a9ef-0000-0200-0000-69551b6e0000\\"",\   "flowType": "Bluefield",\   "hockeyAppId": null,\   "hockeyAppToken": null,\   "id": "/subscriptions/f1332eb1-392f-4b16-9ede-7905848ef248/resourceGroups/rg-koogle-prod/providers/microsoft.insights/components/ai-koogle-prod",\   "immediatePurgeDataOn30Days": null,\   "ingestionMode": "LogAnalytics",\   "instrumentationKey": "b3f53de2-82d7-4149-a468-dbdc486b919c",\   "kind": "web",\   "location": "westeurope",\   "name": "ai-koogle-prod",\   "privateLinkScopedResources": null,\   "provisioningState": "Succeeded",\   "publicNetworkAccessForIngestion": "Enabled",\   "publicNetworkAccessForQuery": "Enabled",\   "requestSource": "rest",\   "resourceGroup": "rg-koogle-prod",\   "retentionInDays": 90,\   "samplingPercentage": null,\   "tags": {},\   "tenantId": "f1332eb1-392f-4b16-9ede-7905848ef248",\   "type": "microsoft.insights/components"\ }
```
$ikey = az monitor app-insights component show -g $RgName -a $AppInsightsName --query instrumentationKey -o tsv
```
KEY: b3f53de2-82d7-4149-a468-dbdc486b919c
### Settings Web-App
```
az webapp config appsettings set -g $RgName -n $WebAppName --settings `
ASPNETCORE_ENVIRONMENT=Production `
APPINSIGHTS_INSTRUMENTATIONKEY=$ikey `
WEBSITE_RUN_FROM_PACKAGE=1
```