Doporučené úlohy, které vám pomůžou aktivně zlepšit zabezpečení předplatného
GET https://management.azure.com/subscriptions/{subscriptionId}/providers/Microsoft.Security/locations/{ascLocation}/tasks?api-version=2015-06-01-preview
S volitelnými parametry:
GET https://management.azure.com/subscriptions/{subscriptionId}/providers/Microsoft.Security/locations/{ascLocation}/tasks?api-version=2015-06-01-preview&$filter={$filter}
Parametry identifikátoru URI
Name |
V |
Vyžadováno |
Typ |
Description |
ascLocation
|
path |
True
|
string
|
Umístění, kam ASC ukládá data předplatného. lze načíst z umístění Získat
|
subscriptionId
|
path |
True
|
string
|
ID předplatného Azure
Vzor regulárního výrazu: ^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$
|
api-version
|
query |
True
|
string
|
Verze rozhraní API pro operaci
|
$filter
|
query |
|
string
|
Filtr OData. Volitelný.
|
Odpovědi
Zabezpečení
azure_auth
Azure Active Directory OAuth2 Flow
Typ:
oauth2
Tok:
implicit
URL autorizace:
https://login.microsoftonline.com/common/oauth2/authorize
Rozsahy
Name |
Description |
user_impersonation
|
zosobnění uživatelského účtu
|
Příklady
Get security recommendations tasks from security data location
Ukázkový požadavek
GET https://management.azure.com/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/providers/Microsoft.Security/locations/westeurope/tasks?api-version=2015-06-01-preview
/**
* Samples for Tasks ListByHomeRegion.
*/
public final class Main {
/*
* x-ms-original-file:
* specification/security/resource-manager/Microsoft.Security/preview/2015-06-01-preview/examples/Tasks/
* GetTasksSubscriptionLocation_example.json
*/
/**
* Sample code: Get security recommendations tasks from security data location.
*
* @param manager Entry point to SecurityManager.
*/
public static void getSecurityRecommendationsTasksFromSecurityDataLocation(
com.azure.resourcemanager.security.SecurityManager manager) {
manager.tasks().listByHomeRegion("westeurope", null, com.azure.core.util.Context.NONE);
}
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
package armsecurity_test
import (
"context"
"log"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/security/armsecurity"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ac34f238dd6b9071f486b57e9f9f1a0c43ec6f6/specification/security/resource-manager/Microsoft.Security/preview/2015-06-01-preview/examples/Tasks/GetTasksSubscriptionLocation_example.json
func ExampleTasksClient_NewListByHomeRegionPager() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armsecurity.NewClientFactory("<subscription-id>", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
pager := clientFactory.NewTasksClient().NewListByHomeRegionPager("westeurope", &armsecurity.TasksClientListByHomeRegionOptions{Filter: nil})
for pager.More() {
page, err := pager.NextPage(ctx)
if err != nil {
log.Fatalf("failed to advance page: %v", err)
}
for _, v := range page.Value {
// You could use page here. We use blank identifier for just demo purposes.
_ = v
}
// If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
// page.TaskList = armsecurity.TaskList{
// Value: []*armsecurity.Task{
// {
// Name: to.Ptr("62609ee7-d0a5-8616-9fe4-1df5cca7758d"),
// Type: to.Ptr("Microsoft.Security/locations/tasks"),
// ID: to.Ptr("/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/providers/Microsoft.Security/locations/westeurope/tasks/62609ee7-d0a5-8616-9fe4-1df5cca7758d"),
// Properties: &armsecurity.TaskProperties{
// CreationTimeUTC: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-03-05T10:42:03.993Z"); return t}()),
// LastStateChangeTimeUTC: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-03-05T10:42:03.993Z"); return t}()),
// SecurityTaskParameters: &armsecurity.TaskParameters{
// AdditionalProperties: map[string]any{
// "location": "uksouth",
// "resourceGroup": "myRg",
// "resourceId": "/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourceGroups/myRg/providers/Microsoft.Network/virtualNetworks/vnet1/subnets/default",
// "resourceName": "default",
// "resourceParent": "vnet1",
// "resourceType": "Subnet",
// "uniqueKey": "/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourceGroups/myRg/providers/Microsoft.Network/virtualNetworks/vnet1/subnets/default",
// },
// Name: to.Ptr("NetworkSecurityGroupMissingOnSubnet"),
// },
// State: to.Ptr("Active"),
// SubState: to.Ptr("NA"),
// },
// },
// {
// Name: to.Ptr("d55b4dc0-779c-c66c-33e5-d7bce24c4222"),
// Type: to.Ptr("Microsoft.Security/locations/tasks"),
// ID: to.Ptr("/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourceGroups/myRg/providers/Microsoft.Security/locations/westeurope/tasks/d55b4dc0-779c-c66c-33e5-d7bce24c4222"),
// Properties: &armsecurity.TaskProperties{
// CreationTimeUTC: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-04-02T11:41:27.054Z"); return t}()),
// LastStateChangeTimeUTC: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-04-02T11:41:27.054Z"); return t}()),
// SecurityTaskParameters: &armsecurity.TaskParameters{
// AdditionalProperties: map[string]any{
// "isDataDiskEncrypted": false,
// "isOsDiskEncrypted": false,
// "resourceId": "/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourceGroups/myRg/providers/Microsoft.Compute/virtualMachines/vm1",
// "severity": "High",
// "uniqueKey": "EncryptionOnVmTaskParameters_/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourceGroups/myRg/providers/Microsoft.Compute/virtualMachines/vm1",
// "vmId": "/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourceGroups/myRg/providers/Microsoft.Compute/virtualMachines/vm1",
// "vmName": "vm1",
// },
// Name: to.Ptr("EncryptionOnVm"),
// },
// State: to.Ptr("Active"),
// SubState: to.Ptr("NA"),
// },
// }},
// }
}
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
const { SecurityCenter } = require("@azure/arm-security");
const { DefaultAzureCredential } = require("@azure/identity");
/**
* This sample demonstrates how to Recommended tasks that will help improve the security of the subscription proactively
*
* @summary Recommended tasks that will help improve the security of the subscription proactively
* x-ms-original-file: specification/security/resource-manager/Microsoft.Security/preview/2015-06-01-preview/examples/Tasks/GetTasksSubscriptionLocation_example.json
*/
async function getSecurityRecommendationsTasksFromSecurityDataLocation() {
const subscriptionId =
process.env["SECURITY_SUBSCRIPTION_ID"] || "20ff7fc3-e762-44dd-bd96-b71116dcdc23";
const ascLocation = "westeurope";
const credential = new DefaultAzureCredential();
const client = new SecurityCenter(credential, subscriptionId);
const resArray = new Array();
for await (let item of client.tasks.listByHomeRegion(ascLocation)) {
resArray.push(item);
}
console.log(resArray);
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
using System;
using System.Threading.Tasks;
using Azure;
using Azure.Core;
using Azure.Identity;
using Azure.ResourceManager;
using Azure.ResourceManager.SecurityCenter;
// Generated from example definition: specification/security/resource-manager/Microsoft.Security/preview/2015-06-01-preview/examples/Tasks/GetTasksSubscriptionLocation_example.json
// this example is just showing the usage of "Tasks_ListByHomeRegion" operation, for the dependent resources, they will have to be created separately.
// get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line
TokenCredential cred = new DefaultAzureCredential();
// authenticate your client
ArmClient client = new ArmClient(cred);
// this example assumes you already have this SecurityCenterLocationResource created on azure
// for more information of creating SecurityCenterLocationResource, please refer to the document of SecurityCenterLocationResource
string subscriptionId = "20ff7fc3-e762-44dd-bd96-b71116dcdc23";
AzureLocation ascLocation = new AzureLocation("westeurope");
ResourceIdentifier securityCenterLocationResourceId = SecurityCenterLocationResource.CreateResourceIdentifier(subscriptionId, ascLocation);
SecurityCenterLocationResource securityCenterLocation = client.GetSecurityCenterLocationResource(securityCenterLocationResourceId);
// get the collection of this SubscriptionSecurityTaskResource
SubscriptionSecurityTaskCollection collection = securityCenterLocation.GetSubscriptionSecurityTasks();
// invoke the operation and iterate over the result
await foreach (SubscriptionSecurityTaskResource item in collection.GetAllAsync())
{
// the variable item is a resource, you could call other operations on this instance as well
// but just for demo, we get its data from this resource instance
SecurityTaskData resourceData = item.Data;
// for demo we just print out the id
Console.WriteLine($"Succeeded on id: {resourceData.Id}");
}
Console.WriteLine($"Succeeded");
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
Ukázková odpověď
{
"value": [
{
"id": "/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/providers/Microsoft.Security/locations/westeurope/tasks/62609ee7-d0a5-8616-9fe4-1df5cca7758d",
"name": "62609ee7-d0a5-8616-9fe4-1df5cca7758d",
"type": "Microsoft.Security/locations/tasks",
"properties": {
"state": "Active",
"subState": "NA",
"creationTimeUtc": "2018-03-05T10:42:03.9935508Z",
"lastStateChangeTimeUtc": "2018-03-05T10:42:03.9935508Z",
"securityTaskParameters": {
"resourceName": "default",
"resourceType": "Subnet",
"resourceParent": "vnet1",
"location": "uksouth",
"resourceGroup": "myRg",
"name": "NetworkSecurityGroupMissingOnSubnet",
"uniqueKey": "/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourceGroups/myRg/providers/Microsoft.Network/virtualNetworks/vnet1/subnets/default",
"resourceId": "/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourceGroups/myRg/providers/Microsoft.Network/virtualNetworks/vnet1/subnets/default"
}
}
},
{
"id": "/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourceGroups/myRg/providers/Microsoft.Security/locations/westeurope/tasks/d55b4dc0-779c-c66c-33e5-d7bce24c4222",
"name": "d55b4dc0-779c-c66c-33e5-d7bce24c4222",
"type": "Microsoft.Security/locations/tasks",
"properties": {
"state": "Active",
"subState": "NA",
"creationTimeUtc": "2018-04-02T11:41:27.0541014Z",
"lastStateChangeTimeUtc": "2018-04-02T11:41:27.0541014Z",
"securityTaskParameters": {
"vmId": "/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourceGroups/myRg/providers/Microsoft.Compute/virtualMachines/vm1",
"vmName": "vm1",
"severity": "High",
"isOsDiskEncrypted": false,
"isDataDiskEncrypted": false,
"name": "EncryptionOnVm",
"uniqueKey": "EncryptionOnVmTaskParameters_/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourceGroups/myRg/providers/Microsoft.Compute/virtualMachines/vm1",
"resourceId": "/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourceGroups/myRg/providers/Microsoft.Compute/virtualMachines/vm1"
}
}
}
]
}
Definice
Name |
Description |
CloudError
|
Běžná chybová odpověď pro všechna rozhraní API Azure Resource Manageru pro vrácení podrobností o chybě pro neúspěšné operace (To se také řídí formátem odpovědi na chybu OData.)
|
CloudErrorBody
|
Podrobnosti o chybě.
|
ErrorAdditionalInfo
|
Další informace o chybě správy prostředků
|
SecurityTask
|
Úloha zabezpečení, kterou doporučujeme provést, aby se posílilo zabezpečení
|
SecurityTaskList
|
Seznam doporučení pro úlohy zabezpečení
|
SecurityTaskParameters
|
Změna sady vlastností v závislosti na typu úkolu odvozeného z pole názvu
|
CloudError
Běžná chybová odpověď pro všechna rozhraní API Azure Resource Manageru pro vrácení podrobností o chybě pro neúspěšné operace (To se také řídí formátem odpovědi na chybu OData.)
Name |
Typ |
Description |
error.additionalInfo
|
ErrorAdditionalInfo[]
|
Další informace o chybě.
|
error.code
|
string
|
Kód chyby.
|
error.details
|
CloudErrorBody[]
|
Podrobnosti o chybě.
|
error.message
|
string
|
Chybová zpráva.
|
error.target
|
string
|
Cíl chyby.
|
CloudErrorBody
Podrobnosti o chybě.
Name |
Typ |
Description |
additionalInfo
|
ErrorAdditionalInfo[]
|
Další informace o chybě.
|
code
|
string
|
Kód chyby.
|
details
|
CloudErrorBody[]
|
Podrobnosti o chybě.
|
message
|
string
|
Chybová zpráva.
|
target
|
string
|
Cíl chyby.
|
ErrorAdditionalInfo
Další informace o chybě správy prostředků
Name |
Typ |
Description |
info
|
object
|
Další informace.
|
type
|
string
|
Další typ informací.
|
SecurityTask
Úloha zabezpečení, kterou doporučujeme provést, aby se posílilo zabezpečení
Name |
Typ |
Description |
id
|
string
|
ID prostředku
|
name
|
string
|
Název prostředku
|
properties.creationTimeUtc
|
string
|
Čas zjištění tohoto úkolu v UTC
|
properties.lastStateChangeTimeUtc
|
string
|
Čas poslední změny podrobností tohoto úkolu v UTC
|
properties.securityTaskParameters
|
SecurityTaskParameters
|
Změna sady vlastností v závislosti na typu úkolu odvozeného z pole názvu
|
properties.state
|
string
|
Stav úkolu (Aktivní, Vyřešeno atd.)
|
properties.subState
|
string
|
Další data o stavu úkolu
|
type
|
string
|
Typ prostředku
|
SecurityTaskList
Seznam doporučení pro úlohy zabezpečení
Name |
Typ |
Description |
nextLink
|
string
|
Identifikátor URI pro načtení další stránky.
|
value
|
SecurityTask[]
|
Úloha zabezpečení, kterou doporučujeme provést, aby se posílilo zabezpečení
|
SecurityTaskParameters
Změna sady vlastností v závislosti na typu úkolu odvozeného z pole názvu
Name |
Typ |
Description |
name
|
string
|
Název typu úkolu
|