%3CLINGO-SUB%20id%3D%22lingo-sub-1583204%22%20slang%3D%22en-US%22%3EMonitoring%20Azure%20Kubernetes%20Service%20(AKS)%20with%20Azure%20Sentinel%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1583204%22%20slang%3D%22en-US%22%3E%3CP%3EIn%202020%20Kubernetes%20only%20marked%20its%20sixth%20birthday%2C%20but%20in%20that%20time%20its%20usage%20has%20grown%20exponentially%20and%20it%20is%20now%20considered%20a%20core%20part%20of%20many%20organization%E2%80%99s%20application%20platforms.%20The%20flexibility%20and%20scalability%20of%20containerized%20environments%20makes%20deploying%20applications%20as%20microservices%20in%20containers%20very%20attractive%20and%20Kubernetes%20has%20emerged%20as%20the%20orchestrator%20of%20choice%20for%20many.%20Azure%20offers%20Azure%20Kubernetes%20Service%20(AKS)%20where%20your%20Kubernetes%20cluster%20is%20managed%20and%20integrated%20into%20the%20platform.%20In%20this%20blog%20we%20are%20going%20to%20look%20at%20how%20you%20can%20use%20Azure%20Sentinel%20to%20monitor%20your%20AKS%20clusters%20for%20security%20incidents.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CH4%20id%3D%22toc-hId--593404623%22%20id%3D%22toc-hId--593404623%22%20id%3D%22toc-hId--593404623%22%3E%3CSTRONG%3EOverview%3C%2FSTRONG%3E%3C%2FH4%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EThere%20are%20several%20sources%20that%20you%20can%20use%20to%20help%20monitor%20your%20AKS%20cluster%2C%20of%20which%20you%20can%20deploy%20one%20or%20several%20in%20tandem%20depending%20on%20your%20environment%20and%20the%20security%20posture%20of%20your%20organization.%20We%20will%20be%20looking%20at%20the%20following%20detection%20sources%20that%20you%20can%20integrate%20into%20Sentinel%3A%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CUL%3E%0A%3CLI%3EAzure%20Security%20Center%20(ASC)%20AKS%20threat%20protection%3C%2FLI%3E%0A%3CLI%3EAzure%20Diagnostics%20logs%3C%2FLI%3E%0A%3CLI%3EThird%20party%20tool%20alert%20integration%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EBelow%20is%20a%20diagram%20illustrating%20how%20these%20different%20sources%20integrate%20into%20Azure%20Sentinel%3A%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-center%22%20image-alt%3D%22AKS%20diagram.PNG%22%20style%3D%22width%3A%20582px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F211949i0D771608C2A93889%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20title%3D%22AKS%20diagram.PNG%22%20alt%3D%22AKS%20diagram.PNG%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EBefore%20we%20dive%20into%20each%20of%20these%20sources%2C%20I%20want%20to%20mention%20an%20excellent%20piece%20of%20work%20created%20by%20my%20colleague%20Yossi%20Weizman%20where%20he%20created%20a%20threat%20matrix%20for%20Kubernetes%20clusters%2C%20aligned%20to%20the%20MITRE%20ATT%26amp%3BCK%20framework.%20You%20can%20read%20his%20full%20article%20%3CA%20href%3D%22https%3A%2F%2Fwww.microsoft.com%2Fsecurity%2Fblog%2F2020%2F04%2F02%2Fattack-matrix-kubernetes%2F%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%22%3Ehere%3C%2FA%3E%20but%20we%20will%20refer%20to%20this%20threat%20matrix%20when%20assessing%20whether%20you%20have%20considered%20if%20this%20scenario%20is%20applicable%20to%20your%20AKS%20implementation%2C%20and%20if%20it%20is%2C%20how%20you%20can%20get%20visibility%20of%20this%20happening%20in%20your%20environment.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CDIV%20id%3D%22tinyMceEditorsarahyo_0%22%20class%3D%22mceNonEditable%20lia-copypaste-placeholder%22%3E%26nbsp%3B%3C%2FDIV%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-center%22%20image-alt%3D%22k8s-matrix.png%22%20style%3D%22width%3A%20999px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F211944i4C537A4E012A93AD%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20title%3D%22k8s-matrix.png%22%20alt%3D%22k8s-matrix.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CH4%20id%3D%22toc-hId-1894108210%22%20id%3D%22toc-hId-1894108210%22%20id%3D%22toc-hId-1894108210%22%3E%3CSTRONG%3EAzure%20Security%20Center%20(ASC)%20AKS%20threat%20protection%3C%2FSTRONG%3E%3C%2FH4%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EAzure%20Security%20Center%20Standard%20has%20threat%20protection%20built-in%20for%20the%20resources%20that%20it%20monitors.%20ASC%20has%20an%20optional%20Kubernetes%20bundle%20that%20you%20can%20enable%2C%20and%20ASC%20threat%20protection%20will%20look%20at%20your%20AKS%20cluster%20for%20signs%20of%20suspicious%20activity.%20To%20enable%20the%20AKS%20bundle%20in%20ASC%2C%20go%20to%20%22Pricing%20%26amp%3B%20settings%22%2C%20select%20the%20subscription%20and%20make%20sure%20the%20%22Kubernetes%22%20resource%20type%20is%20enabled%2C%20as%20per%20the%20below%3A%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22ASC%20AKS.png%22%20style%3D%22width%3A%20999px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F211946iB49E0251F5E7C0D2%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20title%3D%22ASC%20AKS.png%22%20alt%3D%22ASC%20AKS.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CEM%3E(The%20ASC%20Kubernetes%20bundle%20also%20provides%20security%20configuration%20and%20hardening%20recommendations%20for%20your%20AKS%20cluster%2C%20but%20that%20is%20outside%20the%20scope%20of%20this%20blog%20post.%20You%20can%20read%20more%20about%20this%20%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fazure%2Fsecurity-center%2Fazure-kubernetes-service-integration%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%22%3Ehere%3C%2FA%3E.)%3C%2FEM%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EIf%20you%20have%20already%20connected%20ASC%20threat%20alerts%20to%20your%20Azure%20Sentinel%20workspace%20via%20the%20native%20ASC%20connector%20these%20AKS%20threat%20alerts%20will%20also%20be%20sent%20directly%20into%20Azure%20Sentinel.%20Some%20of%20the%20threats%20that%20ASC%20can%20detect%20in%20your%20AKS%20cluster%20are%20below%3A%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CUL%3E%0A%3CLI%3EContainer%20with%20a%20sensitive%20volume%20mount%20detected%3C%2FLI%3E%0A%3CLI%3EDigital%20currency%20mining%20container%20detected%3C%2FLI%3E%0A%3CLI%3EExposed%20Kubernetes%20dashboard%20detected%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EFor%20an%20up-to-date%20list%20of%20ASC%20AKS-specific%20detections%2C%20please%20go%20%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fazure%2Fsecurity-center%2Falerts-reference%23alerts-akscluster%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%22%3Ehere.%3C%2FA%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CDIV%20id%3D%22tinyMceEditorsarahyo_1%22%20class%3D%22mceNonEditable%20lia-copypaste-placeholder%22%3E%26nbsp%3B%3C%2FDIV%3E%0A%3CH4%20id%3D%22toc-hId-86653747%22%20id%3D%22toc-hId-86653747%22%20id%3D%22toc-hId-86653747%22%3E%3CSTRONG%3EAzure%20Diagnostics%20logs%3C%2FSTRONG%3E%3C%2FH4%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EIf%20you%20have%20use%20cases%20not%20covered%20by%20ASC%20threat%20detections%2C%20you%20can%20also%20turn%20on%20AKS%20diagnostic%20logs%20and%20send%20to%20a%20Log%20Analytics%20workspace%20(you%20may%20notice%20that%20some%20documents%20referenced%20here%20refer%20to%20Azure%20Monitor.%20Note%20that%20Log%20Analytics%20is%20part%20of%20the%20larger%20Azure%20Monitor%20platform.)%20Follow%20the%20steps%20found%20-ERR%3AREF-NOT-FOUND-here%20to%20enable%20resource%20logging.%20The%20logs%20that%20can%20be%20retrieved%20from%20AKS%20in%20this%20manner%20include%3A%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CUL%3E%0A%3CLI%3Ekube-apiserver%3C%2FLI%3E%0A%3CLI%3Ekube-controller-manager%3C%2FLI%3E%0A%3CLI%3Ekube-scheduler%3C%2FLI%3E%0A%3CLI%3Ekube-audit%3C%2FLI%3E%0A%3CLI%3Ecluster-autoscaler%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EAfter%20you%20have%20enabled%20the%20logging%20to%20be%20sent%20your%20Log%20Analytics%20workspace%2C%20you%20can%20start%20to%20run%20detections%20on%20these%20logs.%20These%20logs%20will%20be%20sent%20to%20the%20AzureDiagnostics%20table.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3ELet%E2%80%99s%20look%20at%20a%20basic%20query%20you%20can%20on%20these%20logs%20in%20Sentinel%20to%20look%20at%20(in%20this%20case)%20an%20NGINX%20pod%3A%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CPRE%20class%3D%22lia-code-sample%20language-sql%22%3E%3CCODE%3EAzureDiagnostics%0A%7C%20where%20Category%20%3D%3D%20%22kube-apiserver%22%0A%7C%20where%20log_s%20contains%20%22pods%2Fnginx%22%0A%7C%20project%20log_s%3C%2FCODE%3E%3C%2FPRE%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3ENow%20let%E2%80%99s%20look%20at%20some%20more%20security-focused%20queries%20that%20you%20can%20run%20on%20AKS%20logs.%20Note%20that%20we%20are%20using%20the%20threat%20matrix%20mentioned%20earlier%20in%20this%20blog%20as%20a%20guide%20for%20the%20manner%20of%20detections%20one%20may%20require%20on%20an%20AKS%20cluster%3A%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CPRE%20class%3D%22lia-code-sample%20language-sql%22%3E%3CCODE%3E%23%20query%20for%20cluster-admin%20clusterrolebinding%20%2B%20extend%20columns%0A%23%20detects%3A%20kubectl%20create%20clusterrolebinding%20my-svc-acct-admin%20--clusterrole%3Dcluster-admin%0A%0AAzureDiagnostics%0A%7C%20where%20Category%20%3D%3D%20%22kube-audit%22%0A%7C%20where%20parse_json(log_s).verb%20%3D%3D%20%22create%22%0A%7C%20where%20parse_json(tostring(parse_json(tostring(parse_json(log_s).requestObject)).roleRef)).name%20%3D%3D%20%22cluster-admin%22%0A%7C%20where%20parse_json(tostring(parse_json(log_s).requestObject)).kind%20%3D%3D%20%22ClusterRoleBinding%22%0A%7C%20extend%20k8skind%20%3D%20parse_json(tostring(parse_json(log_s).requestObject)).kind%0A%7C%20extend%20k8sroleref%20%3D%20parse_json(tostring(parse_json(tostring(parse_json(log_s).requestObject)).roleRef)).name%0A%7C%20extend%20k8suser%20%3D%20parse_json(tostring(parse_json(log_s).user)).username%0A%7C%20extend%20k8sipaddress%20%3D%20parse_json(tostring(parse_json(log_s).sourceIPs))%5B0%5D%0A%3C%2FCODE%3E%3C%2FPRE%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CPRE%20class%3D%22lia-code-sample%20language-sql%22%3E%3CCODE%3E%23%20query%20for%20CronJob%20creation%0A%0AAzureDiagnostics%0A%7C%20where%20Category%20%3D%3D%20%22kube-audit%22%0A%7C%20where%20parse_json(log_s).verb%20%3D%3D%20%22create%22%0A%7C%20where%20parse_json(tostring(parse_json(log_s).requestObject)).kind%20%3D%3D%20%22CronJob%22%3C%2FCODE%3E%3C%2FPRE%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CPRE%20class%3D%22lia-code-sample%20language-sql%22%3E%3CCODE%3E%23%20query%20for%20actions%20from%20standard%20user%20account%20(az%20aks%20get-credentials)%0A%0AAzureDiagnostics%0A%7C%20where%20Category%20%3D%3D%20%22kube-audit%22%0A%7C%20project%20log_s%0A%7C%20where%20parse_json(tostring(parse_json(log_s).user)).username%20%3D%3D%20%22masterclient%22%3C%2FCODE%3E%3C%2FPRE%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CPRE%20class%3D%22lia-code-sample%20language-sql%22%3E%3CCODE%3E%23%20query%20for%20specific%20source%20IP%0A%0AAzureDiagnostics%0A%7C%20where%20Category%20%3D%3D%20%22kube-audit%22%0A%7C%20project%20log_s%0A%7C%20where%20parse_json(tostring(parse_json(log_s).sourceIPs))%5B0%5D%20%3D%3D%20%22192.168.1.1%22%3C%2FCODE%3E%3C%2FPRE%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CPRE%20class%3D%22lia-code-sample%20language-sql%22%3E%3CCODE%3E%23%20query%20for%20RBAC%20result%20(allow%2C%20deny%2C%20etc.)%0A%0AAzureDiagnostics%0A%7C%20where%20Category%20%3D%3D%20%22kube-audit%22%0A%7C%20project%20log_s%0A%7C%20where%20parse_json(log_s).verb%20%3D%3D%20%22create%22%0A%7C%20where%20parse_json(tostring(parse_json(log_s).annotations)).%5B%22authorization.k8s.io%2Fdecision%22%5D%20%3D%3D%20%22allow%22%3C%2FCODE%3E%3C%2FPRE%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CPRE%20class%3D%22lia-code-sample%20language-sql%22%3E%3CCODE%3E%23%20query%20for%20Azure%20RBAC%20AKS%20role%20assignment%0A%0AAzureActivity%0A%7C%20where%20OperationName%20%3D%3D%20%22Create%20role%20assignment%22%0A%7C%20extend%20RoleDef%20%3D%20tostring(parse_json(tostring(parse_json(tostring(parse_json(Properties).requestbody)).Properties)).RoleDefinitionId)%0A%7C%20extend%20%20Caller%20%3D%20tostring(parse_json(tostring(parse_json(tostring(parse_json(Properties).requestbody)).Properties)).Caller)%0A%7C%20where%20RoleDef%20contains%20%228e3af657-a8ff-443c-a75c-2fe8c4bcb635%22%20or%20RoleDef%20contains%20%22b24988ac-6180-42a0-ab88-20f7382dd24c%22%0A%7C%20extend%20AccountCustomEntity%20%3D%20Caller%0A%7C%20extend%20IPCustomEntity%20%3D%20CallerIpAddress%0A%7C%20extend%20URLCustomEntity%20%3D%20HTTPRequest%0A%7C%20extend%20HostCustomEntity%20%3D%20ResourceId%3C%2FCODE%3E%3C%2FPRE%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EOf%20course%2C%20this%20is%20just%20a%20start%20%E2%80%93%20there%20are%20many%20more%20AKS%20detections%20you%20could%20create%20with%20these%20logs%20that%20will%20be%20specific%20to%20your%20organization%E2%80%99s%20use%20cases%20and%20environment.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CH4%20id%3D%22toc-hId--1720800716%22%20id%3D%22toc-hId--1720800716%22%20id%3D%22toc-hId--1720800716%22%3E%3CSTRONG%3EThird%20party%20tools%3C%2FSTRONG%3E%3C%2FH4%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EIf%20you%20are%20using%20a%20third-party%20Kubernetes%20monitoring%20tool%2C%20this%20can%20also%20be%20integrated%20into%20Sentinel.%20At%20the%20time%20of%20writing%2C%20we%20already%20have%20a%20native%20connector%20for%20Alcide%20kAudit%2C%20but%20look%20for%20more%20native%20integrations%20to%20come%20in%20the%20future!%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3ERemember%2C%20if%20you%20are%20using%20a%20third%20party%20tool%20that%20does%20not%20yet%20have%20a%20native%20connector%20in%20Sentinel%2C%20you%20can%20still%20integrate%20the%20logs%20using%20a%20-ERR%3AREF-NOT-FOUND-custom%20connector.%20For%20example%2C%20Twistlock%20offers%20a%20number%20of%20ways%20to%20pull%20the%20audit%20events%20from%20the%20-ERR%3AREF-NOT-FOUND-product%20itself.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CH4%20id%3D%22toc-hId-766712117%22%20id%3D%22toc-hId-766712117%22%20id%3D%22toc-hId-766712117%22%3E%3CSTRONG%3ESummary%3C%2FSTRONG%3E%3C%2FH4%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3ESentinel%20offers%20many%20options%20for%20monitoring%20AKS%20clusters%2C%20so%20we%20recommend%20that%20you%20look%20at%20your%20organization%E2%80%99s%20environment%20and%20the%20tools%20you%20have%20available%20to%20decide%20on%20a%20strategy%20that%20works%20best%20for%20you.%20Do%20you%20have%20some%20AKS-specific%20detections%2C%20Workbooks%20or%20something%20else%20to%20share%3F%20Please%20contribute%20to%20our%20GitHub%20repo%20-ERR%3AREF-NOT-FOUND-here%20and%20share%20with%20the%20community!%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CEM%3EWith%20thanks%20to%26nbsp%3B-ERR%3AREF-NOT-FOUND-%40GeorgeWilburn%20for%20his%20AKS%20queries%20and%26nbsp%3B-ERR%3AREF-NOT-FOUND-%40Nicholas%20DiCola%20(SECURITY%20JEDI)%26nbsp%3Band%26nbsp%3B-ERR%3AREF-NOT-FOUND-%40Chi%20Nguyen%26nbsp%3Bfor%20their%20comments%20and%20feedback%20on%20this%20article.%3C%2FEM%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-TEASER%20id%3D%22lingo-teaser-1583204%22%20slang%3D%22en-US%22%3E%3CP%3E%26nbsp%3B%3CSPAN%20style%3D%22font-family%3A%20inherit%3B%22%3EIn%20this%20blog%20post%20we%20explore%20how%20to%20use%20Azure%20Sentinel%20to%20monitor%20your%20Azure%20Kubernetes%20Service%20(AKS)%20environments.%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%3CSPAN%20style%3D%22font-family%3A%20inherit%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-center%22%20image-alt%3D%22AKS%20diagram.PNG%22%20style%3D%22width%3A%20400px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F211948i493AD453DBCE7C8C%2Fimage-size%2Fmedium%3Fv%3D1.0%26amp%3Bpx%3D400%22%20title%3D%22AKS%20diagram.PNG%22%20alt%3D%22AKS%20diagram.PNG%22%20%2F%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-TEASER%3E%3CLINGO-LABS%20id%3D%22lingo-labs-1583204%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EAKS%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EASC%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EAzure%20Kubernetes%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EAzure%20Security%20Center%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EAzure%20Sentinel%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EDetection%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EInvestigation%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EKubernetes%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3ESecurity%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1588660%22%20slang%3D%22en-US%22%3ERe%3A%20Monitoring%20Azure%20Kubernetes%20Service%20(AKS)%20with%20Azure%20Sentinel%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1588660%22%20slang%3D%22en-US%22%3E%3CP%3EAnother%20super%20cool%20article%20about%20magical%20things%20we%20can%20do%20now%20%3A)%3C%2Fimg%3E%20Keep%20it%20coming%20guys!%20Good%20job%20%3A)%3C%2Fimg%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E
Microsoft

In 2020 Kubernetes only marked its sixth birthday, but in that time its usage has grown exponentially and it is now considered a core part of many organization’s application platforms. The flexibility and scalability of containerized environments makes deploying applications as microservices in containers very attractive and Kubernetes has emerged as the orchestrator of choice for many. Azure offers Azure Kubernetes Service (AKS) where your Kubernetes cluster is managed and integrated into the platform. In this blog we are going to look at how you can use Azure Sentinel to monitor your AKS clusters for security incidents.

 

 

Overview

 

There are several sources that you can use to help monitor your AKS cluster, of which you can deploy one or several in tandem depending on your environment and the security posture of your organization. We will be looking at the following detection sources that you can integrate into Sentinel:

 

  • Azure Security Center (ASC) AKS threat protection
  • Azure Diagnostics logs
  • Third party tool alert integration

 

Below is a diagram illustrating how these different sources integrate into Azure Sentinel:

 

AKS diagram.PNG

 

Before we dive into each of these sources, I want to mention an excellent piece of work created by my colleague Yossi Weizman where he created a threat matrix for Kubernetes clusters, aligned to the MITRE ATT&CK framework. You can read his full article here but we will refer to this threat matrix when assessing whether you have considered if this scenario is applicable to your AKS implementation, and if it is, how you can get visibility of this happening in your environment.

 

 

k8s-matrix.png

 

Azure Security Center (ASC) AKS threat protection

 

Azure Security Center Standard has threat protection built-in for the resources that it monitors. ASC has an optional Kubernetes bundle that you can enable, and ASC threat protection will look at your AKS cluster for signs of suspicious activity. To enable the AKS bundle in ASC, go to "Pricing & settings", select the subscription and make sure the "Kubernetes" resource type is enabled, as per the below:

 

ASC AKS.png

 

(The ASC Kubernetes bundle also provides security configuration and hardening recommendations for your AKS cluster, but that is outside the scope of this blog post. You can read more about this here.)

 

If you have already connected ASC threat alerts to your Azure Sentinel workspace via the native ASC connector these AKS threat alerts will also be sent directly into Azure Sentinel. Some of the threats that ASC can detect in your AKS cluster are below:

 

  • Container with a sensitive volume mount detected
  • Digital currency mining container detected
  • Exposed Kubernetes dashboard detected

 

For an up-to-date list of ASC AKS-specific detections, please go here.

 

 

Azure Diagnostics logs

 

If you have use cases not covered by ASC threat detections, you can also turn on AKS diagnostic logs and send to a Log Analytics workspace (you may notice that some documents referenced here refer to Azure Monitor. Note that Log Analytics is part of the larger Azure Monitor platform.) Follow the steps found here to enable resource logging. The logs that can be retrieved from AKS in this manner include:

 

  • kube-apiserver
  • kube-controller-manager
  • kube-scheduler
  • kube-audit
  • cluster-autoscaler

 

After you have enabled the logging to be sent your Log Analytics workspace, you can start to run detections on these logs. These logs will be sent to the AzureDiagnostics table.

 

Let’s look at a basic query you can on these logs in Sentinel to look at (in this case) an NGINX pod:

 

AzureDiagnostics
| where Category == "kube-apiserver"
| where log_s contains "pods/nginx"
| project log_s

 

Now let’s look at some more security-focused queries that you can run on AKS logs. Note that we are using the threat matrix mentioned earlier in this blog as a guide for the manner of detections one may require on an AKS cluster:

 

# query for cluster-admin clusterrolebinding + extend columns
# detects: kubectl create clusterrolebinding my-svc-acct-admin --clusterrole=cluster-admin

AzureDiagnostics
| where Category == "kube-audit"
| where parse_json(log_s).verb == "create"
| where parse_json(tostring(parse_json(tostring(parse_json(log_s).requestObject)).roleRef)).name == "cluster-admin"
| where parse_json(tostring(parse_json(log_s).requestObject)).kind == "ClusterRoleBinding"
| extend k8skind = parse_json(tostring(parse_json(log_s).requestObject)).kind
| extend k8sroleref = parse_json(tostring(parse_json(tostring(parse_json(log_s).requestObject)).roleRef)).name
| extend k8suser = parse_json(tostring(parse_json(log_s).user)).username
| extend k8sipaddress = parse_json(tostring(parse_json(log_s).sourceIPs))[0]

 

 

# query for CronJob creation

AzureDiagnostics
| where Category == "kube-audit"
| where parse_json(log_s).verb == "create"
| where parse_json(tostring(parse_json(log_s).requestObject)).kind == "CronJob"

 

 

# query for actions from standard user account (az aks get-credentials)

AzureDiagnostics
| where Category == "kube-audit"
| project log_s
| where parse_json(tostring(parse_json(log_s).user)).username == "masterclient"

 

 

# query for specific source IP

AzureDiagnostics
| where Category == "kube-audit"
| project log_s
| where parse_json(tostring(parse_json(log_s).sourceIPs))[0] == "192.168.1.1"

 

 

# query for RBAC result (allow, deny, etc.)

AzureDiagnostics
| where Category == "kube-audit"
| project log_s
| where parse_json(log_s).verb == "create"
| where parse_json(tostring(parse_json(log_s).annotations)).["authorization.k8s.io/decision"] == "allow"

 

 

# query for Azure RBAC AKS role assignment

AzureActivity
| where OperationName == "Create role assignment"
| extend RoleDef = tostring(parse_json(tostring(parse_json(tostring(parse_json(Properties).requestbody)).Properties)).RoleDefinitionId)
| extend  Caller = tostring(parse_json(tostring(parse_json(tostring(parse_json(Properties).requestbody)).Properties)).Caller)
| where RoleDef contains "8e3af657-a8ff-443c-a75c-2fe8c4bcb635" or RoleDef contains "b24988ac-6180-42a0-ab88-20f7382dd24c"
| extend AccountCustomEntity = Caller
| extend IPCustomEntity = CallerIpAddress
| extend URLCustomEntity = HTTPRequest
| extend HostCustomEntity = ResourceId

 

Of course, this is just a start – there are many more AKS detections you could create with these logs that will be specific to your organization’s use cases and environment.

 

 

Third party tools

 

If you are using a third-party Kubernetes monitoring tool, this can also be integrated into Sentinel. At the time of writing, we already have a native connector for Alcide kAudit, but look for more native integrations to come in the future!

 

Remember, if you are using a third party tool that does not yet have a native connector in Sentinel, you can still integrate the logs using a custom connector. For example, Twistlock offers a number of ways to pull the audit events from the product itself.

 

 

Summary

 

Sentinel offers many options for monitoring AKS clusters, so we recommend that you look at your organization’s environment and the tools you have available to decide on a strategy that works best for you. Do you have some AKS-specific detections, Workbooks or something else to share? Please contribute to our GitHub repo here and share with the community!

 

With thanks to @GeorgeWilburn for his AKS queries and @Nicholas DiCola (SECURITY JEDI) and @Chi Nguyen for their comments and feedback on this article.

1 Comment
Senior Member

Another super cool article about magical things we can do now :) Keep it coming guys! Good job :)