0% found this document useful (0 votes)
10 views27 pages

CCD3

Uploaded by

movinreddy2016
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
10 views27 pages

CCD3

Uploaded by

movinreddy2016
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 27

UNIT-3

1)Explain devops workflow with a neat diagram


A)

2)With a neat diagram give the example of source


structure branch
A)
3)Discuss how main script runs the database script by
setting up the default database
A)
To run database scripts as part of your main pipeline in
Azure DevOps, you typically follow these steps:

Prepare Database Scripts: First, you need to have


scripts that define your database schema and possibly
seed data. These scripts could be SQL scripts,
migrations, or database project files.
Set Up Database Environment: You need to set up the
database environment where your scripts will be
executed. This could be an on-premises database
server, a cloud-hosted database service (like Azure SQL
Database), or a containerized database instance.
Integration into Main Pipeline: Integrate database
scripts execution into your main pipeline. This can be
done using custom scripts or specialized tasks provided
by Azure DevOps or third-party extensions.

inputs:
azureSubscription: 'your_azure_subscription'
AuthenticationType: 'server'
ServerName: '$(databaseServer)'
DatabaseName: '$(databaseName)'
SqlUsername: 'your_sql_username'
SqlPassword: 'your_sql_password'
deployType: 'SqlTask'
SqlFile: '$(sqlScriptsPath)\setup_database.sql'
The setup_database.sql script could contain the
necessary SQL commands to set up the default
database schema, tables, and any initial data required
by your application.

4)Explain how azure manages the scripts and


list the steps involved in environment creation
A)
5)Describe the steps in creating the database
A)
6)Define hotfix ,feature toggles,staging and
master in structure source branch
A) SAME AS 2ND

7)Describe the parameters in scripts and


outline the steps in how to run the scripts
A)
Update the Script: Replace the placeholders in
the script with actual values. These include the
Azure subscription name, SQL Server name,
database name, SQL username, SQL password,
and the path to the SQL script file.
Save the Script: Save the script with an
appropriate name, such as
create_database_pipeline.yml.
Configure Azure DevOps Pipeline: In your Azure
DevOps project, create a new pipeline or edit
an existing one.
Add the Script as a Step: Add the script as a
step in your pipeline definition. You can add it
as a YAML pipeline task using the
SqlAzureDacpacDeployment task.
Specify Parameters: Fill in the parameters
mentioned in the script (azureSubscription,
ServerName, DatabaseName, SqlUsername,
SqlPassword, and SqlFile) with appropriate
values.
Save and Run the Pipeline: Save your changes
and trigger the pipeline to run. This will execute
the SQL script to create the database in the
specified SQL Server.
Verify: After the pipeline execution is
completed, verify that the database has been
created successfully in your SQL Server
instance.
8)Explain the lifecycle of devops
A)
9)Explain error handling and troubleshooting in
microsoft Azure script
A)
9) Error handling and troubleshooting are essential
aspects of writing and running scripts in Microsoft
Azure to ensure smooth execution and quick resolution
of issues. Here's an explanation of error handling and
troubleshooting techniques for Azure scripts:

Error Handling:
Try-Catch Blocks: Use try-catch blocks to handle
exceptions gracefully. This allows you to catch errors
and execute recovery or cleanup operations as needed.
Powershell
code
try {
# Your script code here
} catch {
Write-Error "An error occurred: $_"
# Additional error handling logic here
}
Error Logging: Log errors to a file or send them to
Azure Monitor or Application Insights for centralized
monitoring and analysis.
Powershell
code
try {
# Your script code here
} catch {
$ErrorMessage = $_.Exception.Message
$ErrorTimestamp = Get-Date -Format "yyyy-MM-dd
HH:mm:ss"
Write-Output "$ErrorTimestamp - ERROR:
$ErrorMessage" | Out-File -Append "error.log"
# Additional error handling logic here
}
Alerting: Set up alerts in Azure Monitor to notify you of
script failures or abnormal behavior.
Troubleshooting:
Logging: Add verbose logging throughout your script to
track the execution flow and identify potential issues.
powershell
code
Write-Output "Step 1: Performing operation A"
# Your operation A code here
Write-Output "Step 1: Operation A completed
successfully"
Debugging: Use debugging tools provided by Azure
services or integrated development environments
(IDEs) like Visual Studio Code to step through your
script and inspect variables.
Testing: Test your script in a controlled environment
before running it in production. Use Azure Sandbox,
test subscriptions, or local development environments.
Azure CLI/PowerShell Debugging: Use the --debug flag
with Azure CLI commands or the -Debug parameter
with PowerShell scripts to enable verbose output for
troubleshooting.
powershell
code
az <command> --debug
Resource Status: Check the status of Azure resources
using Azure Portal, Azure CLI, or PowerShell to ensure
they are provisioned and configured correctly.
Azure Activity Log: Review Azure Activity Log to
identify any operations or events related to your script
execution.

10)Explain how to add scripts to source


control in visual studio
A)
11)What is azure . explain azure
management scripts with an example
A)
12)Steps to create the storage account and
website
A)
13)How to store Sensitive Data in
azure?why it is done?
A)
14)What is the reason behind treating
automation scripts as source code?explain
A)
15)Explain Deployment Scipt with detailed
steps?give its benefits
A)

You might also like