Azure -Enable Defender for Server Plan at Resource Level

Опубликовано: 01 Январь 1970
на канале: Girish Sharma
119
10

How to enable defender for server Plan 1 at resource level?
Define variables
$subscriptionId = ""
$resourceGroup = ""
$vmName= ""
$url = "https://management.azure.com/subscrip..."



We also need to authenticate to the api endpoint.

Set access token for the API request
$secureToken = (Get-AzAccessToken -AsSecureString -WarningAction SilentlyContinue).Token
$ptr = [System.Runtime.InteropServices.Marshal]::SecureStringToBSTR($secureToken)
$accessToken = [System.Runtime.InteropServices.Marshal]::PtrToStringAuto($ptr)
[System.Runtime.InteropServices.Marshal]::ZeroFreeBSTR($ptr) # Free the BSTR memory

$headers = @{
"Authorization" = "Bearer $accessToken"
"Content-Type" = "application/json"
}



we prepare the body of our request, including the plan type we will enable. In this case, I will enable Plan 1.


Prepare API request body
$body = @{
location = $location
properties = @{
pricingTier = "Standard"
subPlan = "P1"
}
} | ConvertTo-Json


we call the api endpoint using the PUT method to enable the plan.



Invoke API request to enable the P1 plan on the VM
Invoke-RestMethod -Method Put -Uri $url -Body $body -Headers $headers



Invoke API request to disable the P1 plan on the VM
Invoke-RestMethod -Method Delete -Uri $url -Headers $headers



Azure - Regulatory Compliance Standard (Defender for Cloud) -   • Azure - Regulatory Compliance Standar...  
Azure - Defender for Cloud (SQL DBaaS) !!! -    • Azure - Defender for Cloud (SQL DBaaS...  
Azure - Defender for Cloud (Malware Scanning) -    • Azure - Defender for Cloud (Malware S...  
How to give access to Power BI Workspace !!! -    • How to give access to Power BI Worksp...  
Schedule MS Fabric Capacity !!! -    • Schedule MS Fabric Capacity !!!  
Data Governance with Immutability in azure !!! -    • Data Governance with Immutability in ...  
Azure Stack HCI + AVD -    • Azure Stack HCI + AVD !!!  
Copilot for azure -    • Copilot for MS 365 !!!  
Microsoft Fabric Capacity Metric APP(3) -    • Microsoft Fabric Capacity Metric APP(3)  
Azure - What is Microsoft Fabric(2) ?-    • Azure - What is Microsoft Fabric(2) ?  
How to Link MS Fabric Capacity with Power BI workspace(1) ? -    • How to Link MS Fabric Capacity with P...  
Azure - (In -Place o/s Upgrade) !!! -    • Azure - (In -Place o/s Upgrade) !!!  
Azure Arc Enabled ESU's -    • Azure - Arc Enabled ESU's !!!  
Azure Arc Onboarding -    • Azure Arc - Onboarding !!!  
Azure AI + Custom Data + Chat Bot !!! 😎 -    • Azure AI + Custom Data + Chat Bot !!! 😎  
MS Entra ID Logs Archive !!! -    • MS Entra ID Logs Archive !!!  
Azure - IOT Hub + Stream Analytics + Power BI !!! -    • Azure - IOT Hub + Stream Analytics + ...  
Azure - Analyze Real Time Data !!! -    • Azure - Analyze Real Time Data !!!  
Azure AD PIM (Part 2) -    • Azure AD PIM (Part 2) !!!  
Azure AD PIM Explained (Part 1) -    • Azure AD PIM Explained !!! (Part 1)  
Azure Web APP Service "Access Restriction"(Part 4) -    • Azure APP Service "Access Restriction...  
Azure App Service Scaling(Part 3) -    • Azure App Service Scaling !!!(Part 3)  
Deployment Slots in Azure APP Service Explained (Part 2) -    • Deployment Slots Explained !!! (Part 2)  
Azure APP Service , APP Service Plan Tiers Explained(Part 1) -    • Azure APP & APP Service Plan Explaine...  
Azure - How to create azure AD B2C Tenant? -    • Azure - How to create azure AD B2C Te...  
AVD + INTUNE + Azure AD -    • AVD + INTUNE + Azure AD !!!  
How to assign/remove license within azure AD -    • How to assign/remove license within a...  
Azure Stack HCI 😎 -    • Azure Stack HCI !!!  
How to upgrade to azure Defender -    • How to upgrade to azure Defender?  
Do I need Azure Security Center ? 🙂 -    • Do I need Azure Security Center ? 🙂  
MFA in azure AD(Do I Need to PAY)🤔 -    • MFA in azure AD(Do I Need to PAY) ??? 🤔🤔  
Who is responsible for security in cloud ? 🙂 -    • Who is responsible for security in cl...  
Azure - AVD Deployment with Cloud only Identity -    • Azure - AVD Deployment with Cloud onl...  
Azure AD - Company Branding -    • Azure AD - Company Branding !!!  
Azure Migrate v/s Azure Site Recovery -    • Azure Migrate v/s Azure Site Recovery...  
Azure - What is Hybrid Identity ? -    • Azure - What is Hybrid Identity ?  
Azure Virtual Desktop - "VM on Demand" 🙋‍♂️ -    • Azure Virtual Desktop - "VM on Demand...  
Windows 365 (CLOUD PC EXPLAINED)🤔 -    • Windows 365 (CLOUD PC EXPLAINED) !!!  🤔  
Azure - Resource Mover Explained -    • Azure - Resource Mover Explained !!!  
Azure - How to enable/disable MFA in azure AD? -    • Azure - How to enable/disable MFA in ...  
Azure - Application GW with WAF & APP Service Deployment -    • Azure - Application GW with WAF & APP...  
Azure - "WVD Zero to Hero"😎 -    • Azure - AVD Zero to Hero !!!😎😎😎  
Azure - Radius Server , P2S VPN & AD Domain Services Authentication !!! -    • Azure - Radius Server , P2S VPN & AD ...