Grant-SqlAvailabilityGroupCreateAnyDatabase
Grants the CREATE ANY DATABASE
permission to an Always On Availability Group.
Syntax
Grant-SqlAvailabilityGroupCreateAnyDatabase
[[-Path] <String[]>]
[-Script]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
Grant-SqlAvailabilityGroupCreateAnyDatabase
[-InputObject] <AvailabilityGroup[]>
[-Script]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
Description
Grants the CREATE ANY DATABASE
permission to an Always On Availability Group. If automatic seeding is used to seed the
secondary replica, you must allow database creation on each replica by calling Grant-SqlAvailabilityGroupCreateAnyDatabase
cmdlet.
Examples
Example 1: How to grant create any database permission
PS C:\> Grant-SqlAvailabilityGroupCreateAnyDatabase -Path SQLSERVER:\SQL\MYSERVER\MYINSTANCE\AvailabilityGroupS\AG1
This example shows how to use the cmdlet to grant create any database permission to the Availability Group 'AG1' on SQL Server 'MYSERVER' (instance name 'MYINSTANCE').
Parameters
-Confirm
Prompts you for confirmation before running the cmdlet.
Type: | SwitchParameter |
Aliases: | cf |
Position: | Named |
Default value: | None |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-InputObject
Specifies the target Availability Group object.
Type: | AvailabilityGroup[] |
Position: | 1 |
Default value: | None |
Accept pipeline input: | True |
Accept wildcard characters: | False |
-Path
Specifies the path to the availability group on which this cmdlet runs the operation. If you do not specify a value for this parameter, the cmdlet uses the current working location.
Type: | String[] |
Position: | 1 |
Default value: | None |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-Script
Indicates that this cmdlet returns a Transact-SQL script that performs the task that this cmdlet performs.
Type: | SwitchParameter |
Position: | Named |
Default value: | None |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-WhatIf
Shows what would happen if the cmdlet runs. The cmdlet is not run.
Type: | SwitchParameter |
Aliases: | wi |
Position: | Named |
Default value: | None |
Accept pipeline input: | False |
Accept wildcard characters: | False |
Inputs
Microsoft.SqlServer.Management.Smo.AvailabilityGroup[]