az monitor diagnostic-settings create for App Service with Storage Account archiving throws error
- Dominant language
- Python
- Stars
- 4.6k
- Forks
- 3.5k
- Avg merge
- 3d 2h
- Merged PRs (30d)
- 60
Description
>
**Describe the bug**
When assigning Diagnostic Settings for Azure App Service via Azure CLI that has Storage Account for log Archiving enabled, the exception is thrown.
Text of the exception - (Conflict) Storage account '/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxx/resourcegroups/resource-group-name/microsoft.storage/storageaccounts/storageaccountname' is not accessible yet. Try again when storage provisioning is complete. While any other resource can be assigned with same Diagnostic Settings and storage account.
**To Reproduce**
1. Create App Service (our scenario is Linux Container)
2. Prepare Azure Storage account (or scenario is StorageV2 Standard_GRS Cool)
3. Execute code (variables configured appropriate to the environment):
`az monitor diagnostic-settings create --name $appName --resource $appId --storage-account $strorageName --metrics '[{"category": "AllMetrics","enabled": true, "retentionPolicy": {"enabled": true, "days": 180 }}]'
`
4. Exception is thrown:
`(Conflict) Storage account '/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxx/resourcegroups/resource-group-name/microsoft.storage/storageaccounts/storageaccountname' is not accessible yet. Try again when storage provisioning is complete`
5. Replace App Service for different service (e.g. KeyVault), run the command and there is no exception
6. Assign App Service Diagnostic Settings via Portal with same Storage account - no exception
**Expected behavior**
1. Create App Service (our scenario is Linux Container)
2. Prepare Azure Storage account (or scenario is StorageV2 Standard_GRS Cool)
3. Execute code (variables configured appropriate to the environment):
`az monitor diagnostic-settings create --name $appName --resource $appId \
--storage-account $strorageName \
--metrics '[{"category": "AllMetrics","enabled": true, "retentionPolicy": {"enabled": true, "days": 180 }}]' \
`
4. Diagnostic settings are applied successfully
**Environment summary**
az CLI verions - 2.27.1
OS - Windows 10 20H2
Shell - bash (git bash)
**Additional context**
Contributor guide
Assessment
This issue has not been assessed yet.