Skip to content

Commit b31797e

Browse files
authored
Merge pull request #124489 from isra-fel/patch-1
Adds example to disable local auth for automation account
2 parents 0cd9b0f + 13f2a6e commit b31797e

File tree

1 file changed

+18
-1
lines changed

1 file changed

+18
-1
lines changed

articles/automation/disable-local-authentication.md

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,24 @@ In the Azure portal, you may receive a warning message on the landing page for t
2727
Disabling local authentication doesn't take effect immediately. Allow a few minutes for the service to block future authentication requests.
2828

2929
>[!NOTE]
30-
> - 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.
30+
> - 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`](/powershell/azure/manage-azure-resources-invoke-azrestmethod) cmdlet.
31+
>
32+
> ```azurepowershell-interactive
33+
> $SubscriptionId = "your-subscription-id"
34+
> $ResourceGroupName = "your-resource-group-name"
35+
> $AutomationAccountName = "your-automation-account-name"
36+
> $RequestUri = "https://management.azure.com/subscriptions/$SubscriptionId/resourceGroups/$ResourceGroupName/providers/Microsoft.Automation/automationAccounts/$($AutomationAccountName)?api-version=2023-11-01"
37+
> $Payload = @{
38+
> properties = @{
39+
> disableLocalAuth = $true
40+
> }
41+
> } | ConvertTo-Json
42+
> Invoke-AzRest -Method Patch -Uri $RequestUri -Payload $Payload
43+
>
44+
> # Verify
45+
> $AutomationAccount = (Invoke-AzRest -Method Get -Uri $RequestUri).Content | ConvertFrom-Json
46+
> "disableLocalAuth = $($AutomationAccount.properties.disableLocalAuth)"
47+
> ```
3148
3249
## Re-enable local authentication
3350

0 commit comments

Comments
 (0)