Skip to content

Adds example to disable local auth for automation account #124489

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 18 additions & 1 deletion articles/automation/disable-local-authentication.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,24 @@ In the Azure portal, you may receive a warning message on the landing page for t
Disabling local authentication doesn't take effect immediately. Allow a few minutes for the service to block future authentication requests.

>[!NOTE]
> - Currently, PowerShell support for the new API version (2021-06-22) or the flag – `DisableLocalAuth` is not available. However, you can use the Rest-API with this API version to update the flag.
> - Currently, PowerShell support for the new API version (2021-06-22) or the flag – `DisableLocalAuth` is not available. However, you can use the Rest-API with this API version to update the flag. Here is how to do it with the [`Invoke-AzRestMethod`](https://learn.microsoft.com/powershell/azure/manage-azure-resources-invoke-azrestmethod) cmdlet.

```azurepowershell-interactive
$SubscriptionId = "your-subscription-id"
$ResourceGroupName = "your-resource-group-name"
$AutomationAccountName = "your-automation-account-name"
$RequestUri = "https://management.azure.com/subscriptions/$SubscriptionId/resourceGroups/$ResourceGroupName/providers/Microsoft.Automation/automationAccounts/$($AutomationAccountName)?api-version=2023-11-01"
$Payload = @{
properties = @{
disableLocalAuth = $true
}
} | ConvertTo-Json
Invoke-AzRest -Method Patch -Uri $RequestUri -Payload $Payload

# Verify
$AutomationAccount = (Invoke-AzRest -Method Get -Uri $RequestUri).Content | ConvertFrom-Json
"disableLocalAuth = $($AutomationAccount.properties.disableLocalAuth)"
```

## Re-enable local authentication

Expand Down