Skip to content

Commit d0543a9

Browse files
authored
Adds example disable local auth for automation account
1 parent 540425d commit d0543a9

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
@@ -25,7 +25,24 @@ In the Azure portal, you may receive a warning message on the landing page for t
2525
Disabling local authentication doesn't take effect immediately. Allow a few minutes for the service to block future authentication requests.
2626

2727
>[!NOTE]
28-
> - 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.
28+
> - 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.
29+
30+
```azurepowershell-interactive
31+
$SubscriptionId = "9e223dbe-3399-4e19-88eb-0975f02ac87f"
32+
$ResourceGroupName = "yemingtemp"
33+
$AutomationAccountName = "yemingaa0924"
34+
$RequestUri = "https://management.azure.com/subscriptions/$SubscriptionId/resourceGroups/$ResourceGroupName/providers/Microsoft.Automation/automationAccounts/$($AutomationAccountName)?api-version=2023-11-01"
35+
$Payload = @{
36+
properties = @{
37+
disableLocalAuth = $true
38+
}
39+
} | ConvertTo-Json
40+
Invoke-AzRest -Method Patch -Uri $RequestUri -Payload $Payload
41+
42+
# Verify
43+
$AutomationAccount = (Invoke-AzRest -Method Get -Uri $RequestUri).Content | ConvertFrom-Json
44+
"disableLocalAuth = $($AutomationAccount.properties.disableLocalAuth)"
45+
```
2946

3047
## Re-enable local authentication
3148

0 commit comments

Comments
 (0)