> ## Documentation Index
> Fetch the complete documentation index at: https://ps365.clidsys.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Set MgEnterpriseAppStatus

## SYNOPSIS

Sets the status of an enterprise application (service principal) in Microsoft Graph by setting its 'AccountEnabled' property.

## SYNTAX

### ByApplicationID

```powershell theme={null}
Set-MgEnterpriseAppStatus [-ApplicationID] <String> [-Status] <String> [-GenerateCmdlets]
 [-ProgressAction <ActionPreference>] [-WhatIf] [-Confirm] [<CommonParameters>]
```

### ByDisplayName

```powershell theme={null}
Set-MgEnterpriseAppStatus [-DisplayName] <String> [-Status] <String> [-GenerateCmdlets]
 [-ProgressAction <ActionPreference>] [-WhatIf] [-Confirm] [<CommonParameters>]
```

## DESCRIPTION

This function takes an Application ID or DisplayName as input and enables or disables the service principal (enterprise app)
by using Invoke-MgGraphRequest to set AccountEnabled to true or false.

## EXAMPLES

### EXAMPLE 1

```powershell theme={null}
Set-MgEnterpriseAppStatus -ApplicationID "12345678-1234-1234-1234-123456789012" -Status "Disabled"
```

This command disables the enterprise application with the specified App ID.

### EXAMPLE 2

```powershell theme={null}
Set-MgEnterpriseAppStatus -DisplayName "MyApp" -Status "Enabled"
```

This command enables the enterprise application with the specified display name.

## PARAMETERS

### -ApplicationID

The App ID of the service principal to modify.

```yaml theme={null}
Type: String
Parameter Sets: ByApplicationID
Aliases:

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

### -DisplayName

The display name of the service principal to modify.

```yaml theme={null}
Type: String
Parameter Sets: ByDisplayName
Aliases:

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

### -Status

The status to set for the enterprise application.
Valid values are 'Enabled' or 'Disabled'.

```yaml theme={null}
Type: String
Parameter Sets: (All)
Aliases:

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

### -GenerateCmdlets

If specified, the function will generate the cmdlets and save them to a file instead of executing them.

```yaml theme={null}
Type: SwitchParameter
Parameter Sets: (All)
Aliases:

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

### -WhatIf

Shows what would happen if the cmdlet runs.
The cmdlet is not run.

```yaml theme={null}
Type: SwitchParameter
Parameter Sets: (All)
Aliases: wi

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

### -Confirm

Prompts you for confirmation before running the cmdlet.

```yaml theme={null}
Type: SwitchParameter
Parameter Sets: (All)
Aliases: cf

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

### CommonParameters

This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about\_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216).

## INPUTS

## OUTPUTS

## NOTES

To modify a registered application, use the `Set-MgRegisteredAppStatus` function instead.

## RELATED LINKS

[https://ps365.clidsys.com/docs/commands/Set-MgEnterpriseAppStatus](https://ps365.clidsys.com/docs/commands/Set-MgEnterpriseAppStatus)
