Skip to content

Output should be consistent when resource already exists #32951

@gabbsmo

Description

@gabbsmo

Related command
Creating app registration

az ad app create `
    --display-name $hostname `
    --web-home-page-url $replyUrls[0] `
    --required-resource-accesses "@ApiPermissions.json" `
    --app-roles "@AppRoles.json" `
    --enable-id-token-issuance true `
    --sign-in-audience AzureADMyOrg 

White output: WARNING: Found an existing application instance: (id) [REDACTED]. We will patch it.

Notice that it says 'WARNING' but is not colored.

Creating key vault
az keyvault create --name $hostname --resource-group $ResourceGroupName --enable-rbac-authorization true
Red output: The specified vault: myapp already exists

Creating app service

az webapp create `
    --resource-group $ResourceGroupName `
    --name $AppServiceName `
    --plan $AppServicePlanName `
    --runtime "DOTNETCORE:8.0" `
    --https-only true

Yellow output: Webapp 'myapp' already exists. The command will use the existing app's settings.

Creating function app with flex consumption plan

az functionapp create `
    --resource-group $ResourceGroupName `
    --name $functionAppName `
    --storage-account $AppServiceName `
    --flexconsumption-location $resourceGroup.location `
    --runtime dotnet-isolated `
    --runtime-version "8" `
    --https-only true `
    --os-type Linux `
    --zone-redundant false `
    --disable-app-insights true

Yellow output: Creating deployment storage account container 'app-package-myappfunctions-7453307'...
Red output: Cannot change the site myapp-functions to the App Service Plan ASP-myapp-b159 due to hosting constraints.

It seems that the new storage container is actually never created so the warning seems incorrect.
The new App Service Plan is created but it seems to go away automatically after a while.

Is your feature request related to a problem? Please describe.
When users of my script see errors when a resource already exists it creates unnecessary uncertainty since az is designed to be idempotent.

The inconsistent output error severity makes it unnecessarily difficult to read the console output.

Describe the solution you'd like
I mostly want it to be consistent and not be an error. Warning or information is fine.

Metadata

Metadata

Labels

Auto-AssignAuto assign by botFunctionsaz functionappGraphaz adKeyVaultaz keyvaultOutputPossible-SolutionService AttentionThis issue is responsible by Azure service team.Similar-IssueWeb Appsaz webappapp-service-generalcustomer-reportedIssues that are reported by GitHub users external to the Azure organization.questionThe issue doesn't require a change to the product in order to be resolved. Most issues start as that

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions