> For the complete documentation index, see [llms.txt](https://docs.devolutions.net/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.devolutions.net/powershell-universal/it/comandi-powershell/new-psurole.md).

# New-PSURole

## SINOSSI

Definisce un nuovo ruolo all'interno di PowerShell Universal.

## SINTASSI

### Policy (predefinito)

```
New-PSURole -Name <String> [-Description <String>] [-Policy <ScriptBlock>] [-Disabled] [-DefaultRoute <String>]
 [-Roles <String[]>] [-Permissions <String[]>] [-Priority <Int32>] [-ComputerName <String>]
 [-AppToken <String>] [-Credential <PSCredential>] [-UseDefaultCredentials] [-Integrated] [-TrustCertificate]
 [-Cookies] [<CommonParameters>]
```

### Claim

```
New-PSURole -Name <String> [-Description <String>] -ClaimType <String> -ClaimValue <String> [-Disabled]
 [-DefaultRoute <String>] [-Roles <String[]>] [-Permissions <String[]>] [-Priority <Int32>]
 [-ComputerName <String>] [-AppToken <String>] [-Credential <PSCredential>] [-UseDefaultCredentials]
 [-Integrated] [-TrustCertificate] [-Cookies] [<CommonParameters>]
```

## DESCRIZIONE

Definisce un nuovo ruolo all'interno di PowerShell Universal. I ruoli vengono utilizzati per definire l'autorizzazione all'interno della piattaforma PowerShell Universal. I ruoli possono essere assegnati staticamente a un'identità oppure possono essere assegnati dal blocco di script -Policy. Il blocco di script dei criteri riceve un parametro $User che contiene le informazioni sull'identità e le attestazioni che un'identità ha ottenuto durante l'autenticazione.

I blocchi di script dei criteri devono restituire $true o $false per determinare se a questa particolare identità debba essere assegnato il ruolo.

Le configurazioni dei ruoli sono archiviate in .universal/roles.ps1

È inoltre possibile utilizzare questo cmdlet per creare ruoli tramite l'API REST.

## ESEMPI

### Esempio 1

```
New-PSURole -Name 'Developers' -Policy {
    param($User)

    $User.Claims.HasClaim('myGroup')
}
```

Crea un nuovo ruolo con un criterio definito che verifica se l'attestazione dell'utente contiene l'attestazione 'myGroup'.

## PARAMETRI

### -AppToken

L'AppToken utilizzato per chiamare la PowerShell Universal Management API. È inoltre possibile chiamare Connect-PSUServer prima di chiamare questo cmdlet per impostare l'AppToken per l'intera sessione.

```yaml
Type: String
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```

### -ComputerName

Specifica il nome del computer o l'URL da chiamare quando si accede alla PowerShell Universal Management API. È inoltre possibile utilizzare Connect-PSUServer prima di chiamare questo cmdlet per impostare il nome del computer per l'intera sessione.

```yaml
Type: String
Parameter Sets: (All)
Aliases: Uri

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```

### -Description

La descrizione di questo ruolo da mostrare all'interno dell'Admin Console.

```yaml
Type: String
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```

### -Name

Il nome di questo ruolo. Il nome viene utilizzato sia per la visualizzazione sia per l'assegnazione di risorse come API e dashboard.

```yaml
Type: String
Parameter Sets: (All)
Aliases:

Required: True
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```

### -Policy

Il blocco di script dei criteri da eseguire per determinare se assegnare questo ruolo.

```yaml
Type: ScriptBlock
Parameter Sets: Policy
Aliases:

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```

### -UseDefaultCredentials

Utilizza le credenziali predefinite durante la connessione alla Management API

```yaml
Type: SwitchParameter
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```

### -Integrated

Esegue il comando internamente anziché utilizzare la Management API. Funziona solo quando si esegue lo script dall'interno di PowerShell Universal.

```yaml
Type: SwitchParameter
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```

### -ClaimType

Il tipo di attestazione da mappare per questo ruolo. Consulti la mappatura da ruolo ad attestazione nella nostra documentazione.

```yaml
Type: String
Parameter Sets: Claim
Aliases:

Required: True
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```

### -ClaimValue

Il valore dell'attestazione da mappare per questo ruolo. Consulti la mappatura da ruolo ad attestazione nella nostra documentazione.

```yaml
Type: String
Parameter Sets: Claim
Aliases:

Required: True
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```

### -Disabled

Indica se il ruolo è disabilitato.

```yaml
Type: SwitchParameter
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```

### -DefaultRoute

L'URL predefinito verso cui inoltrare gli utenti con questo ruolo.

```yaml
Type: String
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```

### -Roles

Ruoli figlio da assegnare agli utenti a cui è assegnato questo ruolo.

```yaml
Type: String[]
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```

### -Credential

Credenziali per accedere alla PowerShell Universal Management API.

```yaml
Type: PSCredential
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```

### -Permissions

Autorizzazioni assegnate agli utenti a cui viene concesso questo ruolo.

```yaml
Type: String[]
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```

### -TrustCertificate

Indica se il cmdlet deve ignorare i problemi relativi ai certificati.

```yaml
Type: SwitchParameter
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```

### -Priority

La priorità di questo ruolo. Determina quale reindirizzamento utilizzare quando a un utente sono assegnati più ruoli.

```yaml
Type: Int32
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```

### -Cookies

Riutilizza e mantiene i cookie di autenticazione per la sessione PowerShell corrente.

```yaml
Type: SwitchParameter
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```

### CommonParameters

Questo cmdlet supporta i parametri comuni: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutBuffer, -OutVariable, -PipelineVariable, -Verbose, -WarningAction, -WarningVariable e -ProgressAction. Per maggiori informazioni, consulti [about\_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216).

## INPUT

### Nessuno

## OUTPUT

### System.Object

## NOTE

## COLLEGAMENTI CORRELATI


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.devolutions.net/powershell-universal/it/comandi-powershell/new-psurole.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
